How to set Session Timeout in web.config

There are two way to set session timeout property in ASP.Net.

First Method : Edit the following in your web.config fle.

<configuration>
<system.web>
<sessionState mode="InProc" cookieless="true" timeout="60">
</
sessionState>
</system.web>
</configuration>

 

Second Method : Go to global.asax file and write the code below:.

void Session_Start(object sender, EventArgs e)
{
     Session.Timeout = 60;
}


Also please refer the suggessions @ https://www.codeproject.com/Questions/464873/Validation-of-viewstate-MAC-failed


  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

URL Rewrite/mod_rewrite for Windows on IIS 7.x 8.x

For customers who are looking for a URL rewrite function (like Apache's mod_rewrite) on our...

Windows IIS Server - Reditect http:// to https://

Using the following code in your web.config file automatically redirects visitors to the HTTPS...

Enabling Cache on Your Windows Hosting Account using clientCache

With our Windows hosting accounts, you can create caching rules to enhance your website's speed...

Disabling Browser Cache on Windows Server static files

The following configuration sample adds an HTTP "Cache-Control: no-cache" header to the response,...

Scheduled Tasks (cron job)

Scheduling Tasks (Windows) If you need to run scripts on your hosting account at specific time,...