Session.Timeout after 20 seconds not working

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
 
G

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
Peter
 
A

Astrix

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 ?
 
G

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

Juan T. Llibre

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

=?ISO-8859-1?Q?G=F6ran_Andersson?=

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

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top