现在的位置: 首页 > 综合 > 正文

My interested stuff(2008-08-03)

2012年08月08日 ⁄ 综合 ⁄ 共 1616字 ⁄ 字号 评论关闭

SQL

 Excel

Add-in

Web

Other

 

How do I detect a session has expired and redirect it to another page

override protected void OnInit(EventArgs e)
  {
       base.OnInit(e);
if (Context.Session != null)
   {    if (Session.IsNewSession)
    {
    string szCookieHeader = Request.Headers["Cookie"];
     if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
     {
      Response.Redirect("sessionTimeout.htm");
     } 
    }
   }
  }

抱歉!评论已关闭.