About the author

Vijay Kodali
E-mail me Send mail

Recent comments



The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2024

Session timeout error in Asp.Net

1.) We were facing timeout issue on one of our servers. Web.config settings had no effect on the time out.

2.) I have set the session to last 24 hours with this statement in my web.config:

		<sessionState mode="InProc" timeout="720"/>	

     But the session still ends after 20 min of inactivity. What am I missing here?

I saw similar type of questions frequently in Asp.Net forums. Here is a post to help those

What is Session State?

ASP.NET session state enables you to store and retrieve values for a user as the user navigates ASP.NET pages in a Web application. In order to preserve server memory, ASP.NET implements a rolling timeout mechanism which discards the session information for a user if no request is seen within the timeout period (default 20 minutes which is reset with each request).

You would also have to setup session timeout in IIS in addition to webconfig settings.

In IIS6 change the session timeout setting by going to:
'Configuration' Button -> 'Options' Tab -> Tick Enable Session state, increase value from default 20 mins to desired value

In IIS7 change the session timeout setting by going to:

Features View pane –> Application Development – >Sessions state

IIS 7-1 

IIS 7-2

Don’t see Session state icon in IIS 7? Check this blog post


Here are some other reasons for Session loss..

1.) IIS worker process restart or Application Pool recycle.(Check the System logs)

2.) Application Domain restart due to Antivirus scans or changes in Config files.


Please leave a comment.

Posted by vijay on Sunday, December 2, 2007 8:37 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Add comment

(Will show your Gravatar icon)

  Country flag

  • Comment
  • Preview