void Session_Start(object sender, EventArgs e) { if (Session.IsNewSession) { HttpCookie sessionCookie = Request.Cookies["ASP.NET_SessionId"]; if ((null != sessionCookie) && !string.IsNullOrEmpty(sessionCookie.Value)) { Response.Redirect("login.aspx?ReturnUrl=" + Request.Url.LocalPath); } else { return; } } else { if (Session.Count == 0) { Response.Redirect("login.aspx?ReturnUrl=" + Request.Url.LocalPath); } else { return; } } }
void Session_End(object sender, EventArgs e) { if (Session.Count==0) { return; } else { Application.Lock(); Application["UsersOnline"] = (int)Application["UsersOnline"] - 1; Application.UnLock(); Session.Clear(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)