ASP.NET 2.0 session state timeout

Sometime I have to be ASP.NET 2.0 guru. The customer support requested to increase session time from default 20 minutes to desired 60 minutes. The developer responded with the following fix:
Go into Internet Information Services (IIS) Manager
Locate the web site under "Web Sites"
Right click on the correct site and Select "Properties"
On the tabbed dialog click the ASP.NET tab
Click Edit Configuration
Click on the "State Management" tab
Set Session timeout to 60 minutes and click OK.

It will help our customers, but only until the next redeployment of this application. Quickbuild configured to do the clean deployment, meaning it wipes up all files on the server and deploy the new ones from Subversion repository. As result web.config will be replaced with the files from SVN and the session timeout will be reset back to default 20 minutes. My suggestion is to update web.config file in our version control system by adding sessionState element to the section as and redeploy the application.

That's not all folks! There are a few changes needs to be done on IIS level:
Go to Internet Information Services (IIS) Manager again
Locate the web site under "Web Sites"
Right click on the correct site and select "Properties"
On the tabbed dialog click the Home Directory tab
Click Configuration.
In the Application Configuration dialog box, click the Options tab
Make sure Enable session state is checked
Set Session.Timeout value to 60

Do you think we are done now? Not yet :
Select Application Pools of web site 
Select Properties
Select the Performance tab
Set Shutdown worker processes after being idle to 60 under Idle timeout

Now the last step :
Restart the web site

Are we there yet? No. All the steps above we applied only to QA environment. I have to document everything, store the change document in Subversion, submit change request for QA environment and notify QA that the fix is ready for testing. If the testing is successful, the IIS configuration change will be applied on the production IIS environment during next maintenance window.

No comments: