How To Set Session Timeout in Web.config

Session timeout period can be set as you required simply changing web.config file of your web site. In ASP.NET web site once you add web.config file you can find tag. Inside this tag you can specify session timeout value. Add following code to your web.config file.

<system.web>
<sessionstate timeout="60"/>
</system.web>

In this example you have set sessionState timeout value to 60 minutes. You can change this value as you wish, but need to make sure that it is really required. For example if you set a very large value for timeout, your session will hang on forever in the server. This will lead some security issues, memory overflow issues and sometime unexpected behaviour of your web site. And also this value should not be very small values. For example if you have functions like uploading files in the web site, then you should give enough time to upload a file based on the size of the file, network traffic and bandwidth limitation of the client machine.

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails

Twitter Updates

    follow me on Twitter