I used Global.asax and this two codes give me error after session has timeout, like: 'Response is not available in this context.' - if I used Response.Redirect 'Object reference not set to an instance of an object.' - if I used HttpContext.Current.Response.Redirect
Global.asax
protected void Session_End(object sender, EventArgs e)
{
//HttpContext.Current.Response.Redirect("timeout.aspx");
Response.Redirect("~/timeout.aspx");
}
and this is on my Web.Config
Web.Config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors defaultRedirect="../error_page/" mode="Off"/>
<sessionState timeout="1" cookieless="false" mode="InProc" ></sessionState>
</system.web>
</configuration>
SessionTimeout.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
Session["CustomSessionId"] = Guid.NewGuid();
}
Do you guys have any solutions, suggestion especially snippets to make this work out? I am just an entry level programmer, not an advance one.