I have an expired session issue..
I have a pasepage class that detects when a session is expired and redirects them to another page.
This works fine...however..on the redirect page is a link to the default.aspx page. The idea is that they shoudl be able to go back to that page and restart the applkication with a new session.
But all that happens is that it redetects that the session was expired and sends them back to the expired session page.
Here is the code in the base page.
public class BasePage : System.Web.UI.Page
{
public BasePage()
{
}
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))
{
string test = Request.Url.PathAndQuery;Response.Redirect("SessionExpired.aspx");
}
}
}
}
The problem ultimately lies in this section
string szCookieHeader = Request.Headers["Cookie"];if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
{
string test = Request.Url.PathAndQuery;
Response.Redirect(
"SessionExpired.aspx");
}
The reason I say its the problem is that on the sessionexpired.aspx page there is a link that redirects back to the defualt.aspx page. however when the default.aspx page loads if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0)) reevaluates back to true and so the response redirect back tot he sessionexpired page runs again./.its a loop I cant figure out how to break out of so the user can use teh application again.