我正在使用由.NET asp/C#代码驱动的网站。客户端要求会话有25分钟的超时时间。但是,有时会使用该网站,并且用户长时间保持连接状态(超过25分钟)。 Session_End中被触发:如何避免由于超时造成的HttpException
protected void Session_End(Object sender, EventArgs e)
{
Hashtable trackingInformaiton = (Hashtable)Application["trackingInformation"];
trackingInformaiton.Remove(Session["trackingID"]);
}
用户以后返回了一段时间,但是当他们与网站互动,他们得到一个错误,我们得到这个电子邮件通知:
User: Unauthenticated User
Error: System.Web.HttpException
Description: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request...
的的说明问题的一部分堆栈跟踪为System.Web.UI.Control.AddedControl
。显然,服务器已经丢弃了会话数据,并且正在发送新数据,但客户端正试图处理旧数据。因此,错误"the control tree into which viewstate is being loaded [doesn't] match the control tree that was used to save the viewstate during the prevoius request."
所以这里的问题。如果强制如何在连接超时时指示用户的浏览器重定向到“您已注销”屏幕? (这是我应该添加到Session_End方法吗?)
+1这可能是最简单的选择。谢谢。 – 2010-07-22 20:12:37