Asp.net 移动浏览器Net 1.1上的Viewstate无效-自2014年2月13日起
昨天,我们开始在一个ASP.NET网站(1.1)中发现间歇性无效的Viewstate错误,该网站在过去几年中一直运行良好Asp.net 移动浏览器Net 1.1上的Viewstate无效-自2014年2月13日起,asp.net,.net-1.1,Asp.net,.net 1.1,昨天,我们开始在一个ASP.NET网站(1.1)中发现间歇性无效的Viewstate错误,该网站在过去几年中一直运行良好 System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: Invalid_Viewstate Client IP: xxx.xxx.xxx.xxx Port: 55415
System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: Invalid_Viewstate Client IP: xxx.xxx.xxx.xxx Port: 55415 User-Agent: UCWEB/2.0 (Linux; U; Adr 4.1.2; en-US; ST27i) U2/1.0.0 UCBrowser/8.7.0.315 U2/1.0.0 Mobile ViewState: dDwyMDMzMzIzOTc5O3Q8O2w8aTwz.....
Http-Referer: http://www.mysite.com/default.aspx Path: /default.aspx. ---> System.FormatException: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at System.Web.UI.LosFormatter.Deserialize(String input) at System.Web.UI.Page.LoadPageStateFromPersistenceMedium() ....
奇怪的是我们没有对代码做任何更改,问题只是自己开始的
已执行所有常规检查,如machine.config验证密钥等
最后,通过关闭ViewStateMac,解决了桌面浏览器的问题:
<pages enableViewStateMac="False" />
自从这些更新发布以来,还有其他人在.net 1.1中看到无效的视图状态吗?
没有关于MS更新更改内容的具体信息。从不设置EnableViewStateMac=false
您看到的错误最可能的原因是请求超时,导致服务器接收到不完整的负载。如果希望处理速度较慢的客户端,请尝试在Web.config()中增加的值。我们使用的是.NET 4.5,我刚刚在Web日志中看到以下异常
System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted.
---> System.Web.UI.ViewStateException: Invalid viewstate.
Client IP: [CENSORED]
Port: 52119
Referer: [CENSORED] Path: [CENSORED] (an ASPX page in our app)
ViewState: [CENSORED]
---> System.FormatException: Invalid length for a Base-64 char array or string.
at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() --- End of inner exception stack trace ---
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
at System.Web.UI.WebControls.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
用户代理是:
用户代理:UCWEB/2.0(MIDP-2.0;U;Adr 2.3.5;en-US;TECNO_P3)U2/1.0.0 UCBrowser/9.1.1.420 U2/1.0.0 Mobile
它不是一个蜘蛛,因为用户实际上在事后向我们报告了问题。我安装了最新的Android和iOS(iPad)版本的浏览器,并使用类似于我们的日志为该用户显示的工作流测试了我们的页面。结果是该页面似乎工作正常。因此,我将回到用户那里,建议他们可能需要将UC浏览器升级到最新版本
据介绍,浏览器试图通过代理和云压缩来提高性能;如果不小心的话,我可以很容易地看到对Viewstate的干扰。我还发现浏览器的整体“气味”有点垃圾,有过多的附属/内容链接、评级征集等。我会要求我们的支持团队建议我们的用户尝试更主流的浏览器。.NET 1.1在序列化方面有几个错误。如果Windows Update修复了其中一些bug,我也不会感到惊讶。
System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted.
---> System.Web.UI.ViewStateException: Invalid viewstate.
Client IP: [CENSORED]
Port: 52119
Referer: [CENSORED] Path: [CENSORED] (an ASPX page in our app)
ViewState: [CENSORED]
---> System.FormatException: Invalid length for a Base-64 char array or string.
at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose)
at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() --- End of inner exception stack trace ---
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
at System.Web.UI.WebControls.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)