Re: Simple Session Timeout for 60 minutes

S

Shan Plourde

You need to set your session timeout in your web.config.
<sessionState mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424" ... timeout="60"/>

Timeout = "60". This works regardless of your IIS setting described
below I believe. I'm not sure what IIS sessions are.

Open IIS in Computer Management. Right Click on your website and select
Properties from the pop up menu. Navigate to the "Home Directory" tab.
Click the Configuration button. Click the Options tab. This is IIS
session timeout which I believe is different from .NET sessions.
Shan
 
K

Kevin Spencer

Note that tripling the Timeout for Sessions is going to increase memory use
on the server for every user on your site. Chances are, this (tripling the
Timeout value) is the wrong solution to a problem you haven't mentioned.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Shan Plourde said:
You need to set your session timeout in your web.config.
<sessionState mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424" ... timeout="60"/>

Timeout = "60". This works regardless of your IIS setting described
below I believe. I'm not sure what IIS sessions are.

Open IIS in Computer Management. Right Click on your website and select
Properties from the pop up menu. Navigate to the "Home Directory" tab.
Click the Configuration button. Click the Options tab. This is IIS
session timeout which I believe is different from .NET sessions.
Shan
If I set Session.Timeout = 60 in Page_Load function of in the script section
of the HTML page - I still get default of 20 minutes always. How can I
ensure a session timeout of 60 minutes and not the default of 20 minutes.
Also, 20 minutes for the other web pages is ok, but for my main page - I
want this to be 60 minutes.
 
S

Shan Plourde

web.configs can be specified in each subdirectory of your web
application. If your .aspx page happens to be in a single directory with
no other pages or subdirectories that users can navigate to, then you
can add a web.config file and specify the state setttings there I
believe. I believe that the session settings for all other pages outside
of that directory will then use your top level web.config file.

IF that is not possible, you can set the session timeout on your page
that you want it set:
http://msdn.microsoft.com/library/d...ionStateHttpSessionStateClassTimeoutTopic.asp

Session.Timeout = 60;

If your other pages default to 20 minutes in your web.config, and you
specify Session.Timeout = 60; in your Page_Load() method for the single
page that you want.

Of course if users go to your "60 minute session page" and then to a "20
minute session page" and back and forth, your intention may not work as
intended and there may be nothing that you can do about that.
Shan
 
S

Shan Plourde

Try making sure that your IIS session time out setting is set to 60
minutes (the greater timeout that you specify). Then ensure that your
web.config matches this. This way the 20 minute session timeout, or
exception to every other timeout, is explicitly specified.

The other option is to architect entirely different web applications if
that is possible. I think that you'll have a lot of issues implementing
this reliably.
 
G

Guest

(1) Default Web Site in IIS session timeout is 60 minutes
(2) web.config "timeout=60"
(3) only 1 web app - five page web site for data entry - so new architec of multiple web applications is not logical nor possible

Results: still get ALWAYS session timeout as 20 minutes. Basically, I've noticed that whenever the timeout setting for a web page is set to value > (in page load) , then the system will trigger a "session end" event - i.e., Session_End(...) of global.asas.vb is called whenever timeout>20 setting anywhere - this applies to specifically to reposts of the web page.

NOTE: Still even - if I have a trace in another page - and set a breakpoint @ the statement & attempt to set the Session.Timeout value - the debugger ALWAYS says 20 minutes when it comes to the page_load function - even though for this example all pages are set to 60 and web.config and IIS are 60 too! Somewhere it gets reset by IIS to 20 always!

Please Advise!
 
G

Guest

Finally - what about timeout setting in machine.config file for Framework. Is this overriding the timeout values that I'm attempting to set.
 
A

Alvin Bruney [MVP]

nope webconfig file settings will over ride it except for process level.

i've had that problem too on my app. timeout is set to 3 hours. it always
times out after 20 minutes irrespective. i dug my head in the sand on this
one because i didn't have the discipline to go after it.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top