Hi,
In my website, I inherit each web page's class from a base class for checking session timeout
Partial Class Default
Inherits SessionManagement
.
.
End Class
SessionManagement class looks as
Imports Microsoft.VisualBasic
Public Class SessionManagement
Inherits System.Web.UI.Page
Public m_bIgnoreSessionTimeout As Boolean = False
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
Dim sPageName As String = String.Empty
Try
MyBase.OnInit(e)
If m_bIgnoreSessionTimeout = True Then
Exit Sub
End If
If Not Context.Session Is Nothing Then
If Session.IsNewSession = True Then
Dim sCookieHeader As String = Request.Headers("Cookie")
If IsNothing(sCookieHeader) = False Then
If sCookieHeader.IndexOf("ASP.NET_SessionId") > -1 Then
Session.Abandon()
Response.Redirect("~/SessionTimeout.htm", False)
HttpContext.Current.ApplicationInstance.CompleteRequest()
'End If
End If
End If
End If
Catch ex As Exception
Session.Abandon()
Response.Redirect("~/SessionTimeout.htm", False)
HttpContext.Current.ApplicationInstance.CompleteRequest()
End Try
End Sub
End Class
The sessiontimeout.htm page exists in the same folder as of default.aspx.
When the session expires or times out, the default page tries to go to sessiontimeout.htm but gives error 400
I right clicked on it and checked the url, it showed me
http://<webserver name="">/MyWebSite/%2fMyWebSite%2fsessiontimeout.htm
My question is why it did not try to redirect to the path as http://<webserver name="">/MyWebSite/sessiontimeout.htm and instead chose the path above by appending <sitename>/sessiontimeout.htm to the base url?
Thanks
Vijay