ASP.NET session expired simple solution

Add the following code to the template.master.cs file:

        protected void Page_PreRender(object sender, EventArgs e)
        
{
            HttpContext.Current.Response.AppendHeader(
"Refresh",
                Convert.ToString(((HttpContext.Current.Session.Timeout 
* 60- 5))
                
+ "; Url=default.aspx?timeout=true");

        }


obviously, the value Url=default.aspx?timeout=true would be that of an informational page or  a parameter added onto the default.aspx page that when opened diplays the 'information' panel.
posted @ 2007-10-01 05:53  Vincent Yang  阅读(341)  评论(0编辑  收藏  举报