Session.Timeout after 20 seconds not working

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

  1. Astrix

    Astrix Guest

    Hi,

    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)
    {
    //BLAH BLAH
    Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout *
    60) - 1180) +"; URL=index.aspx");
    //BLAH BLAH

    }

    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..

    Thankyou,
    Astrix
    Astrix, Jul 16, 2007
    #1
    1. Advertising

  2. 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
    Peter
    --
    Recursion: see Recursion
    site: http://www.eggheadcafe.com
    unBlog: http://petesbloggerama.blogspot.com
    bogMetaFinder: http://www.blogmetafinder.com



    "Astrix" wrote:

    > Hi,
    >
    > 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)
    > {
    > //BLAH BLAH
    > Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout *
    > 60) - 1180) +"; URL=index.aspx");
    > //BLAH BLAH
    >
    > }
    >
    > 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..
    >
    > Thankyou,
    > Astrix
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 16, 2007
    #2
    1. Advertising

  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
    #3
  4. 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.
    --
    Recursion: see Recursion
    site: http://www.eggheadcafe.com
    unBlog: http://petesbloggerama.blogspot.com
    bogMetaFinder: http://www.blogmetafinder.com



    "Astrix" wrote:

    > 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 ?
    >
    >
    >
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Jul 16, 2007
    #4
  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, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "Astrix" <> wrote in message news:...
    > 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 ?
    >
    >
    Juan T. Llibre, Jul 16, 2007
    #5
  6. Astrix wrote:
    > 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 ?
    >


    The only way the server can know that is that the browser is requesting
    the "another page".

    --
    Göran Andersson
    _____
    http://www.guffa.com
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Jul 17, 2007
    #6
  7. Astrix

    Astrix Guest

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

    Thankyou,
    Astrix
    Astrix, Jul 17, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    7
    Views:
    16,951
    tshad
    Mar 11, 2005
  2. 00_CP_D12
    Replies:
    3
    Views:
    8,900
    dilipv
    Feb 22, 2008
  3. Stu
    Replies:
    7
    Views:
    1,749
    Dave Thompson
    Mar 7, 2005
  4. Michael Tan
    Replies:
    32
    Views:
    960
    Ara.T.Howard
    Jul 21, 2005
  5. `p
    Replies:
    7
    Views:
    366
    Steve Litt
    Dec 14, 2005
Loading...

Share This Page