您的位置:首页 > 产品设计 > UI/UE

程序运行出现错误:System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded

2010-07-29 09:04 671 查看
近日在使用ArcGIS Server打印出图时,在打印完成后,关闭操作面板Pannel时,页面上总是提示:

System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
在 System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
在 System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument)
在 System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument)
在 System.Web.UI.WebControls.RadioButtonList.LoadPostData(String postDataKey, NameValueCollection postCollection)
在 System.Web.UI.WebControls.RadioButtonList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
在 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

查找到的原因是:

应该是因为asp.net2.0默认以EnableEventValidateion验证, 所以当你的程序以客户端脚本进行postback或向前台输出html标记时,可能会引发类似的验证异常,回发或回调参数无效。在配置中使用 <pages enableEventValidation="true"/> 或在页面中使用 <%@ Page EnableEventValidation="true" %> 启用了事件验证。出于安全目的,此功能验证回发或回调事件的参数是否来源于最初呈现这些事件的服务器控件。如果数据有效并且是预期的,则使用 ClientScriptManager.RegisterForEventValidation 方法来注册回发或回调数据以进行验证。

解决办法:

在页面的<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 中添加 EnableEventValidation="false" 就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐