如果你在asp.net 的站点的网址后面加上这么一串?__VIEWSTATE=YY
例如:
你将得到一个类似这样的报错页面:
要解决这个问题其实也很简单:
在后台页面加上这么一段代码 就OK了
代码 1 protected override void OnInitComplete(EventArgs e) 2 { 3 base .OnInitComplete(e); 4 if (Request.QueryString.AllKeys.Contains( " __VIEWSTATE " )) 5 { 6 PropertyInfo info = typeof (System.Collections.Specialized.NameValueCollection).GetProperty( " IsReadOnly " , BindingFlags.Instance | BindingFlags.NonPublic); 7 if (info != null ) 8 { 9 info.SetValue(Request.QueryString, false , null ); 10 Request.QueryString.Remove( " __VIEWSTATE " ); 11 info.SetValue(Request.QueryString, true , null ); 12 } 13 } 14 }
转载于:https://www.cnblogs.com/BenWong/archive/2010/02/11/1667553.html
