Session.Timeout after 20 seconds not working

  • Thread starter Thread starter Astrix
  • Start date Start date
A

Astrix

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
 
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
 
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 ?
 
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.
 
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 said:
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".
 
Back
Top