• "The state information is invalid for this page and might be corrupted"错误的一个解决办法


    今天收到一个bug,在FF 3.0.7上用浏览器的"后退"回到某一个页面,会出现"The state information is invalid for this page and might be corrupted"的错误,抛出信息:

    Code
    Error : The state information is invalid for this page and might be corrupted.
    Detail:   
    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)

    分析应该是ViewState校验出错产生的信息,正常浏览情况下不会出现问题.因为只有用"后退"之类的操作才会出现错误.就怀疑是浏览器的缓存问题,就在Page_Load加入:

    Code
    Response.Cache.SetNoStore();

    作用是告诉浏览器不要缓存页面.在测试页面成功,不会再发生错误.

  • 相关阅读:
    git clone 解决Permission Denied (publickey)问题
    json-server 的基本使用
    存储过程的基本使用(1)
    Linux中的yum是什么?如何配置?如何使用?
    搭建博客园皮肤
    PSCP和SCP区别和用法
    Linux 磁盘分区和挂载
    win10产生文件的哈希值
    linux下刻录iso到U盘
    jquery鼠标移入移出
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1467479.html
Copyright © 2020-2023  润新知