how use ASP.NET_SessionId cookies to check timeout for 2 different web applications
Posted
by
user553858
on Stack Overflow
See other posts from Stack Overflow
or by user553858
Published on 2010-12-27T17:15:11Z
Indexed on
2010/12/27
17:54 UTC
Read the original article
Hit count: 221
ASP.NET
Hi All
I am developing 2 web applications based on "ASP.NET_SessionId" cookies to check session timeout and also to logout :
protected void Session_Start(object sender, EventArgs e)
{
if (Context.Session != null)
{
//check the IsNewSession value, this will tell us if the session has been reset
if (Session.IsNewSession)
{
string cookie = Request.Headers["Cookie"];
// Code that runs when a new session is started
if ((null != cookie) && (cookie.IndexOf("ASP.NET_SessionId") >= 0))
{
if (Request.QueryString["timeout"] == null || !Request.QueryString["timeout"].ToString().Equals("yes"))
Session.Abandon();
Session.Clear();
Response.Redirect("Login.aspx?timeout=yes");
}
}
}
}
This works fine for my first application. When implementing the same logic for the 2nd application when I press logout in one application, the second application is redirected to the login page.
How can I fix this?
Best regards
© Stack Overflow or respective owner