I’ve got a section of code that redirects users to a page when their session times out:
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
string szCookieHeader = HttpContext.Current.Request.Headers["Cookie"];
if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
{
HttpContext.Current.Response.Redirect("SessionTimeout.aspx");
}
}
The problem is that IIS can’t find SessionTimeout.aspx because its looking in the wrong place:
The file '/site/site/site/site/site/site/Site/SessionTimeout.aspx' does not exist.
With more and more “/site/” levels being added as time goes on. I can suppress the problem by creating a tree of “…/site/site/…” and placing an SessionTimeout.aspx in each but this is obviously not a true solution.
Does anyone know what’s going on?
Have you tried to use ~ ?
that will be resolved at runtime with the full url of your site.