转自:http://www.blueidea.com/bbs/newsdetail.asp?id=2243449&posts=current] using System; public class basePageSessionExpire : System.Web.UI.Page { public basePageSessionExpire() { } override protected void OnLoad(EventArgs e) { if(Page.IsPostBack){ if (Context.Session != null) { if (Session.IsNewSession) { string strCookieHeader = Request.Headers ["Cookie"]; if (null != strCookieHeader && strCookieHeader.IndexOf ("ASP.NET_SessionId") >= 0) { if (Request.IsAuthenticated) { System.Web.Security.FormsAuthentication.SignOut (); } Response.Redirect("../Session_Timeout.html"); } } } } base.OnLoad(e); } override protected void OnInit(EventArgs e) { base.OnInit(e); } }