zoukankan      html  css  js  c++  java
  • asp.net 隐藏页面<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value=''>的值

     protected LosFormatter losFormatter = new LosFormatter();
    
        protected override object LoadPageStateFromPersistenceMedium()
        {
            string key = Request.RawUrl + "__viewstate";
    
            if (Session[key] != null)
            {
                object obj = null;
                using (System.IO.MemoryStream stream = (System.IO.MemoryStream)Session[key])
                {
                    stream.Seek(0, System.IO.SeekOrigin.Begin);
                    obj = losFormatter.Deserialize(stream);
                }
                Session[key] = null;
                return obj;
            }
    
            return null;
        }
    
        protected override void SavePageStateToPersistenceMedium(object viewState)
        {
            string key = Request.RawUrl + "__viewstate";
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            losFormatter.Serialize(stream, viewState);
            stream.Flush();
            Session[key] = stream;
        }
  • 相关阅读:
    hdu 2295 DLX
    hdu 4714 树形DP
    hdu 4711 动态规划
    hdu 3656 DLX
    hust 1017 DLX
    hdu 3938 并查集
    hdu 3652 打表
    poj 2152 树形DP
    洛谷P1266速度限制
    洛谷P1841重要的城市
  • 原文地址:https://www.cnblogs.com/slyzly/p/2528264.html
Copyright © 2011-2022 走看看