Home > Archive > ASP .NET > July 2004 > Simple Session Timeout for 60 minutes
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Simple Session Timeout for 60 minutes
|
|
| DavidS 2004-07-27, 4:02 pm |
| I need to have an ASPX web page timeout if no rendering for 60 minutes. 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 mi
nutes 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.
Can you help (p.s. please don't forward me to pay site for solution too)
| |
| Bobby Ryzhy 2004-07-27, 8:59 pm |
| On Tue, 27 Jul 2004 12:40:04 -0700, DavidS <DavidS@discussions.microsoft.com> wrote:
>I need to have an ASPX web page timeout if no rendering for 60 minutes. 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 m
inutes 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.
>Can you help (p.s. please don't forward me to pay site for solution too)
Just change the value in your IIS settings.
Bobby Ryzhy
bobby @ domain below
[url]http://w endtech.net[/url]
| |
| Shan Plourde 2004-07-28, 4:01 pm |
| 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
DavidS wrote:
>I need to have an ASPX web page timeout if no rendering for 60 minutes. 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 m
inutes 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.
>Can you help (p.s. please don't forward me to pay site for solution too)
>
>
| |
| Kevin Spencer 2004-07-28, 4:01 pm |
| 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" <------@---.net> wrote in message
news:faGNc.772$vIJ.466@news04.bloor.is.net.cable.rogers.com...
> 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
>
> DavidS wrote:
>
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.[color=darkred]
>
| |
| DavidS 2004-07-28, 4:01 pm |
| Basically, we only have about 1 dozen users of a web site. There not computer literate - and have problems with simple data entry. So 60 minutes for one web page to them is required - and resources used is minimal.
Basically - I'd like an answer to my question - and not something else.
"Kevin Spencer" wrote:
> 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" <------@---.net> wrote in message
> news:faGNc.772$vIJ.466@news04.bloor.is.net.cable.rogers.com...
> 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.
>
>
>
| |
| DavidS 2004-07-28, 4:01 pm |
| Will this default setting of "60" be applied to all pages. Or will this be the default max for the web site - and thereafter can I change other pages selectively to twenty minutes as I use Session.Timeout = 20 in the page_load function?
"Shan Plourde" wrote:
> 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
>
> DavidS wrote:
>
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.[color=darkred]
>
>
| |
| DavidS 2004-07-28, 4:01 pm |
| I don't want 60 minutes for every page - I want 60 minutes for one page and the others to use default of 20 minutes. So is you suggestion a solution to this problem?
"Bobby Ryzhy" wrote:
> On Tue, 27 Jul 2004 12:40:04 -0700, DavidS <DavidS@discussions.microsoft.com> wrote:
>
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.[color=darkred]
>
>
> Just change the value in your IIS settings.
>
>
> Bobby Ryzhy
> bobby @ domain below
> [url]http://w endtech.net[/url]
>
| |
| Shan Plourde 2004-07-28, 4:01 pm |
| 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...imeoutTopic.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
DavidS wrote:
[color=darkred]
>Will this default setting of "60" be applied to all pages. Or will this be the default max for the web site - and thereafter can I change other pages selectively to twenty minutes as I use Session.Timeout = 20 in the page_load function?
>
>"Shan Plourde" wrote:
>
>
>
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.[color=darkred]
| |
| DavidS 2004-07-29, 3:58 pm |
| A problem occurs. For this discussion - I have two web pages, "Page20.aspx" and "Page60.aspx".
In the Page_Load function for each page, I have "Session.Timeout=20 - Page20.aspx" and
"Session.Timeout=60 - Page60.aspx" respectively.
What happens next is as follows, if I browse to a web page that has "20 minutes" for session timeout - identical with
default in web.config - I view the page.
Next, I browse to the page that has "60 minutes" for session timeout. It appears that IIS sees the
60 minute timeout value - via Page_Load function - it automatically resets the server timeout and loses any
other session variable, then reposts the page. Same happens then if I go from a "60 minute timeout" page
to a "20 minute timeout" page - it resets the timer completely - I lose prior saved values - and the page
gets refreshed. What causes this? How can I prevent this?
All I'd like to do is open web page - have timer refreshed - not reset the session variables.
Please Advise.
"Shan Plourde" wrote:
> 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...imeoutTopic.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
>
> DavidS wrote:
>
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.[color=darkred]
>
>
| |
| DavidS 2004-07-29, 3:58 pm |
| Upon further review - anytime the session timeout is set to a value greater than 20 minutes - I'm seeing that on all postbacks for the web page - the session variables are lost. Does anyone else receive this problem! I believe this is Microsoft Problem
- please confirm - since I would like to know a resolution or if there is a setting not to reset session variables on postbacks - NOTE: NOT A PROBLEM WHEN 20 minutes!
"DavidS" wrote:
[color=darkred]
> A problem occurs. For this discussion - I have two web pages, "Page20.aspx" and "Page60.aspx".
> In the Page_Load function for each page, I have "Session.Timeout=20 - Page20.aspx" and
> "Session.Timeout=60 - Page60.aspx" respectively.
> What happens next is as follows, if I browse to a web page that has "20 minutes" for session timeout - identical with
> default in web.config - I view the page.
> Next, I browse to the page that has "60 minutes" for session timeout. It appears that IIS sees the
> 60 minute timeout value - via Page_Load function - it automatically resets the server timeout and loses any
> other session variable, then reposts the page. Same happens then if I go from a "60 minute timeout" page
> to a "20 minute timeout" page - it resets the timer completely - I lose prior saved values - and the page
> gets refreshed. What causes this? How can I prevent this?
>
> All I'd like to do is open web page - have timer refreshed - not reset the session variables.
>
> Please Advise.
>
> "Shan Plourde" wrote:
>
f 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.[color=darkred]
| |
| Shan Plourde 2004-07-29, 3:58 pm |
| 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.
DavidS wrote:
>Upon further review - anytime the session timeout is set to a value greater than 20 minutes - I'm seeing that on all postbacks for the web page - the session variables are lost. Does anyone else receive this problem! I believe this is Microsoft Problem
- please confirm - since I would like to know a resolution or if there is a setting not to reset session variables on postbacks - NOTE: NOT A PROBLEM WHEN 20 minutes![color=darkred]
>
>"DavidS" wrote:
>
>
>
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.[color=darkred]
| |
| DavidS 2004-07-29, 3:58 pm |
| (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.asa
s.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 a
re set to 60 and web.config and IIS are 60 too! Somewhere it gets reset by IIS to 20 always!
Please Advise!
"Shan Plourde" wrote:
> 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.
>
> DavidS wrote:
>
em - please confirm - since I would like to know a resolution or if there is a setting not to reset session variables on postbacks - NOTE: NOT A PROBLEM WHEN 20 minutes![color=darkred]
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.[color=darkred]
>
>
| |
| DavidS 2004-07-29, 3:58 pm |
| Finally - what about timeout setting in machine.config file for Framework. Is this overriding the timeout values that I'm attempting to set.
"DavidS" wrote:
> (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.a
sas.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![color=darkred]
>
> Please Advise!
>
> "Shan Plourde" wrote:
>
blem - please confirm - since I would like to know a resolution or if there is a setting not to reset session variables on postbacks - NOTE: NOT A PROBLEM WHEN 20 minutes![color=darkred]
t 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.[color=darkred]
| |
| Alvin Bruney [MVP] 2004-07-31, 3:56 am |
| 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.
--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"DavidS" <DavidS@discussions.microsoft.com> wrote in message
news:4607AD82-8A57-45A8-BD6C-D6F430D7285E@microsoft.com...[color=darkred]
> Finally - what about timeout setting in machine.config file for Framework.
> Is this overriding the timeout values that I'm attempting to set.
>
> "DavidS" wrote:
>
| |
|
| Have you tried looking in your Global.asax file?
I recently ran into the same issue where someone defined a 60minute time out in the Global.asax, however in IIS, Web.Config etc. all had 20minutes specified.
quote: Originally posted by DavidS
Finally - what about timeout setting in machine.config file for Framework. Is this overriding the timeout values that I'm attempting to set.
"DavidS" wrote:
> (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.a
sas.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![color=darkred]
>
> Please Advise!
>
> "Shan Plourde" wrote:
>
blem - please confirm - since I would like to know a resolution or if there is a setting not to reset session variables on postbacks - NOTE: NOT A PROBLEM WHEN 20 minutes![color=darkred]
t 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.[color=darkred]
|
|
|
|
|