Microsoft ReportViewer: Session Expired Errors

前端 未结 6 1929
野的像风
野的像风 2021-02-04 01:34

The project is ASP.NET 2.0, I have never been able to reproduce this myself, but I get emails informing me it happens to clients many times a week, often a few times in a row.

6条回答
  •  无人及你
    2021-02-04 02:33

    We had the same problem. So far, we only found it when the session expired but they used the back button in a browser that does aggressive caching, which is fine. But the ReportViewer tried to to a refresh even though the main page did not. So, we just added some hacky Global.asax error handling:

    protected void Application_Error(object sender, EventArgs e)
    {
        Exception exc = Server.GetLastError().GetBaseException();
        if (exc is Microsoft.Reporting.WebForms.AspNetSessionExpiredException)
        {
            Server.ClearError();
            Response.Redirect(FormsAuthentication.LoginUrl + "?ReturnUrl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery), true);
        }
    }
    

提交回复
热议问题