locked
session timeout error RRS feed

  • Question

  • User-306584176 posted

    Hi everyone!

    Okey... I'm out of ideas, don't know how to do this. This is the first time I'm doing session timeouts and I'm really not so clued up on this. It pics up when the session ends but It's giving me an error when I try to redirect to the login form... No Idea why... This is what I've tried:

    void Session_End(object sender, EventArgs e) 
        {
            Response.Redirect("~/frmLogin.aspx");
    }
    
    <sessionState timeout="1"/>
    Can anybody tell me what I'm doing wrong? or help me in the right direction... please....

    This is the error that I get: Response is not available in this context.

    Thursday, June 30, 2011 3:31 AM

Answers

  • User-1161841047 posted

    I've searched and figured out that we can't use response.redirect in Session_End,
    because it is firing internally by the server.
    You can find this link I think it will help you http://forums.asp.net/t/1137344.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 30, 2011 6:01 AM

All replies

  • User-1161841047 posted

    Try to use

     System.Web.HttpContext.Current.Response.Redirect('...')
    
    Thursday, June 30, 2011 3:52 AM
  • User-306584176 posted

    It gives me an error: Object reference not set to an intance of an object...?

    Thursday, June 30, 2011 3:56 AM
  • User-1161841047 posted

    I've searched and figured out that we can't use response.redirect in Session_End,
    because it is firing internally by the server.
    You can find this link I think it will help you http://forums.asp.net/t/1137344.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 30, 2011 6:01 AM
  • User-306584176 posted

    Thanks this will work :-)

    Thursday, June 30, 2011 8:28 AM