session Expired

In my application does not use  session variables, and we set it as timout is 60 min in web.config file, eventhough it doesnot consider web.config settings, so my requirement is my page should not expire at anycost user keep the page ,  pls give me the sample solution for resolve this issue.
LVL 1
Jeyakumar_mcpAsked:
Who is Participating?
 
abelCommented:
>  so my requirement is my page should not expire at anycost user keep the page ,

why not simply set the Session timeout to (almost) indefinite. That should do the trick quite well, don't you think? Microsoft has this to say:

"The Timeout property cannot be set to a value  greater than 525,600 minutes (1 year). The default value is 20 minutes."
-- Abel --
0
 
abelCommented:
you say: you do not use session variables...
you say: you have a session timeout
you say: you do not consider web.config...

the session is always there, whether you want it or not. But you don't have to use it. The web.config is always there, without it your pages will not run, the settings are being considered.

The session timeout will fire, but why care? You don't use sessions, you say. So the session timeout is irrelevant.
0
 
Tony McCreathTechnical SEO ConsultantCommented:
Often you want to stop a session timing out while a user still has a page open on the website.

One way to do this is have some javascript that pings the website on a timer. This way the javascript will keep refreshing the rolling session timeout.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Jeyakumar_mcpAuthor Commented:
Please give me some sample code for using timer control
0
 
Tony McCreathTechnical SEO ConsultantCommented:
Having large session timeouts means all session data for all sessions will stay in memory for a long time. This may not be a good thing.

The javascript method will only keep the sessions alive while a user still has there browser open to the website.

This seems like a good ASP.Net articles on using javascript to stop timeouts

http://www.codeproject.com/KB/session/Reconnect.aspx

Here's some basic javascript timer code


<SCRIPT Language="Javascript">
function TimerCallback()
{
  window.alert("It's Time!");
  setTimeout('TimerCallback()', 5000); /* repeat the timer */
}
setTimeout('TimerCallback()', 5000); /* initial timer */
</SCRIPT>

Open in new window

0
 
abelCommented:
I agree to that reading. But what if you want to keep the session even if the user closes the browser? But that's another story (answer: use a session state server would make things easier).

On a similar note, you can try this (quite beautiful imo) solution as well. It follows, however, the same line of thought as Tiggerito's solution, so if you like it, don't forget to give him his part of the credits ;-) . Here: http://www.codeproject.com/KB/aspnet/SessionForever.aspx


0
 
Tony McCreathTechnical SEO ConsultantCommented:
Sessions are normally tracked by cookies in the browser. Once the browser is closed it is not possible to re-establish a session.

However, the server has no way of knowing if a browser is closed or just idle, hence the concept of rolling session timeouts.

abel,

As you say, your article reference seems to be a variant on the same theme as the one I found. I like the embeded image idea.
0
 
abelCommented:
@TheLearnedOne: I don't agree to deletion, this question received excellent coverage. Question was "how to prevent timeout of session". Both http:#24223480 (indefinite session, by abel) and http:#24223760 (client side refresh timer, by Tiggerito) provide answers. Both are needed to prevent the timeout from happening.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.