遇到很奇怪的问题 EnsureEventValidationFieldLoaded() +297
错误信息如下:
Server Error in '/ ' Application.
--------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.Util.StringUtil.GetStringHashCode(String s) +35
System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded() +297
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +67
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +31
System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +408
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3776
整个网站是从一个.net1.1下移植到2.0的.以前一点问题都没有.最近我没有参加这个项目去做别的项目了.最近出现问题才叫我回来帮忙.发现任何postback都不行.google, msn都搜遍了上也找不到答案.麻烦有经验的给解答一下.
多谢了.
------解决方案--------------------先确定是程序问题还是环境问题
------解决方案--------------------从你的描述来看,升级到ASP.NET2.0之后,当程序运行时你的一个页面总是抛出一些验证异常,对吗?
是不是这个异常总是在当你postback时发生?以我的经验来看,因为asp.net2.0默认以EnableEventValidateion验证,
所以当你的程序以客户端脚本进行postback或向前台输出html标记时,可能会引发类似的验证异常,你可以尝试一下在@Page指令中禁用EnableEventvalidation以查后效
-------------仅供参考
------解决方案--------------------2.0 最讨人厌就是EnableEventvalidation
有时候点击一个按钮,就爆出错误说回调事件的参数不是来源于最初呈现这些事件的服务器控
------解决方案--------------------看不出来是什么问题,1.1转到2.0这样的事情尽量少做!
------解决方案--------------------帮LZ顶