In my web.config file I tried Session.Timeout="1"
and found working. Later I tried Session.Timeout="20160"
. Even if I give such a large number my website "Session Transfers" are being expired in 15-20mins. Do I need to change any settings in IIS? I am using windows 2003 server.
Asked
Active
Viewed 2,684 times
4

painotpi
- 6,894
- 1
- 37
- 70

Karthik Malla
- 5,570
- 12
- 46
- 89
-
Are you using Forms Authentication for your pages by any chance? – Dan7el Jul 06 '11 at 12:42
-
Not sure but I think yes. Its default IIS provided with windows 2003 server. – Karthik Malla Jul 06 '11 at 12:43
-
Is the website shutting down? Session timeout won't stop your websites app domain being shut down by IIS if the website is inactive. Try logging the Application_End event in Global.asax. You can increase the idle timeout in the IIS configuration for the site. – James Gaunt Jul 06 '11 at 12:45
-
1I am sending a code from one page to another for authentication. This code is currently stored as session. When I reload page instantly there is no problem. If I reload page after 20 mins page is being redirected to login page. i.e. there is no more session code present over the page. – Karthik Malla Jul 06 '11 at 12:50
-
If it's exactly 20 mins then this is also the default idle timeout - so if your site is idle for that 20 mins then increase the idle timeout in the iis settings. – James Gaunt Jul 06 '11 at 13:00
-
Try setting you session.Timeout to 1440. Your Session variables are no longer valid when referenced after 24 hours(1440). Which is why setting it to 20160 does nothing – Gage Jul 06 '11 at 13:05
4 Answers
2
define in the web configuration file:
<sessionstate
mode="inproc"
cookieless="false"
timeout="20"
/>
0
define in here in web.config file:
<system.web>
<authentication mode="Forms">
<forms timeout="50" />
</authentication>
</system.web>

Saeed Neamati
- 35,341
- 41
- 136
- 188
-
-
1In that case, I post a new question to know what is their difference? – Saeed Neamati Jul 06 '11 at 12:41
-
1cookieless sessions can easily be hijacked, so try and avoid. the following article outlines the problems. http://www.troyhunt.com/2010/07/owasp-top-10-for-net-developers-part-3.html – Nickz Jul 06 '11 at 12:47
-
1
-
2@kars, just wanted to point out its important to avoid cookieless sessions. – Nickz Jul 06 '11 at 13:28
0
check this :

Ovais Khatri
- 3,201
- 16
- 14
-
I configured my server with these settings before a month but instead to change values for 20 to 14400 I disabled the check box and saved settings. Hope this will be optimized to the maximum time. – Karthik Malla Jul 06 '11 at 12:46
0
Seems like session timeout has a max of 24 hours. Check this out http://support.microsoft.com/kb/233477
Set it to 24 hours or less and you will be fine.
Also explained here: http://msdn.microsoft.com/en-us/library/ms525473(v=vs.90).aspx
IIS 6.0: The minimum allowed value is 1 minute and the maximum is 1440 minutes.

Gage
- 7,365
- 9
- 47
- 77