Session.Timeout after 20 seconds not working

Discussion in 'ASP .Net' started by Astrix, Jul 16, 2007.

  1. Astrix

    Astrix Guest


    I have been working with Sessions for some weeks now, but i can't seem
    to solve this issue. Please have a look ..

    void Page_Load(Object sender, EventArgs e)
    Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout *
    60) - 1180) +"; URL=index.aspx");


    I have set the Refresh to 20 seconds.. Although I refreshed this page
    a number of times, the page gets automatically redirected after 20
    seconds no matter how many times i refreshed the page in between ?

    Any help will be appriciated..

    Astrix, Jul 16, 2007
    1. Advertisements

  2. Astrix

    Guest Guest

    Hmm. I don't have this issue at all. If I repeatedly refresh the page (before
    the expiry time) it never redirects to the other page.
    1) Your browser may be caching this, so you can try some no-cache code.
    2) You can also try script - using window.setTimeout or setInterval and then
    location.href =newpage.aspx
    Guest, Jul 16, 2007
    1. Advertisements

  3. Astrix

    Astrix Guest

    Thank you for the feedback Peter. You are right Thanks..

    But i have another doubt,

    The client will redirect with the above code, how will the server know
    that the client has redirected to another page thou ?
    Astrix, Jul 16, 2007
  4. Astrix

    Guest Guest

    Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout *
    60) - 1180) +"; URL=index.aspx?id=" + youruserId.ToString() );

    Pick up the Request.QueryString["id"] in the target page.
    Guest, Jul 16, 2007
  5. re:
    !> how will the server know that the client has redirected to another page though ?

    It won't...unless you include the user's info in the querystring or in a hidden field.
    Juan T. Llibre, Jul 16, 2007
  6. The only way the server can know that is that the browser is requesting
    the "another page".
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jul 17, 2007
  7. Astrix

    Astrix Guest

    Thankyou all for the comments, I now understand the concept.

    Astrix, Jul 17, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.