用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > Net教程

aspx不显示ViewState的实例

时间:2015-01-29  来源:互联网  作者:佚名
复制代码 代码如下:
System.IO.StringWriter html = new System.IO.StringWriter();
             System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(html);
             base.Render(tw);
             string Temp = html.ToString();
             string s1 = string.Empty, s2 = string.Empty, s3 = string.Empty, s4 = string.Empty, s5 = string.Empty, s6 = string.Empty;
             int i = 0;
             int j = 0;

             i = Temp.IndexOf("<form");
             if (i > 0)
             {
                 j = Temp.IndexOf(">", i);
                 s1 = Temp.Substring(0, i);
                 s2 = Temp.Substring(j + 1, Temp.Length - j - 1);
             }

             i = s2.IndexOf("<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\"");
             if (i > 0)
             {
                 j = s2.IndexOf(">", i);
                 s3 = s2.Substring(0, i);
                 s4 = s2.Substring(j + 1, s2.Length - j - 1);
             }

             i = s4.IndexOf("<input type=\"hidden\" name=\"__EVENTVALIDATION\" id=\"__EVENTVALIDATION\"");
             if (i > 0)
             {
                 j = s4.IndexOf(">", i);
                 s5 = s4.Substring(0, i);
                 s6 = s4.Substring(j + 1, s4.Length - j - 1);
                 Temp = s1 + s3 + s5 + s6;
             }
             else
             {
                Temp = s1 + s3 + s4;
             }
             Temp = Temp.Replace("</form>", "");
             Temp = Temp.Replace("\r\n", "");
             tw.Close();
             Response.Write(Temp);            
来顶一下
返回首页
返回首页
推荐资讯
DataGridView多维表头的实现方法 DataGridView多维表头的实现方法背景对于.NET 原本提供的DataGridView控件,制作成如下形式的
.net 刷新页面后弹出重试框的解决方法 .net 刷新页面后弹出重试框的解决方关闭模式窗口后,需要刷新父页面,但是模式窗口关闭后,父页
相关文章
栏目更新
栏目热门