Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Global.asax file After session timeout the redirection process shows error as "Response is not available in this context".

my code is here:

protected void Session_End(object sender, EventArgs e)
        {
            Response.Redirect(Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~\\Index.aspx));
        }


pls help
Posted

1 solution

Simple: The HttpContext is not available in the Session_End event (or the Session_Start event either) because it is not associated with any request (i.e. the request did not come from the client - which if it had would mean that the session is not ending after all). The whole idea is the session no longer exists, there is no connection for you to redirect!
 
Share this answer
 
Comments
vivekx2 9-Feb-12 5:11am    
any other way to redirect the page......
OriginalGriff 9-Feb-12 5:25am    
Not when the session is ended, no - the session is ended. There is no valid connection to the client. That is what session end means...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900