Friday, 18 March 2016

How to set session timeout in web.config OR Global.asax OR IIS in ASP.Net and MVC


set session timeout in web.config OR Global.asax OR IIS  in ASP.Net and MVC

Web.config:
<configuration>
<system.web>
 <sessionState mode="InProc" timeout="60">
 </sessionState>
 </system.web>
</configuration>

Global.asax:
void Session_Start(object sender, EventArgs e)
{
Session.Timeout = 24 * 60; //24 Hours
}
IIS setting:
     1) Open IIS start-->run type-->inetmgr and press enter.
     2) Right Click on "Default Web Site" go to properties
     3) Select Asp.Net tab, click on "Edit Configuration" Button 
     4) Select "State Management tab" in new popup window
     In case if you are using IIS7
     Select Default Web Site >> Click on Session State
     Once open Session State set timeout in under cookie settings section like as shown below
  

 

No comments: