How to Set Session Timeout in ASP.NET

There are two ways to set a session timeout in ASP.NET.
 
First method:
 
Go to web.config file and add following script where sessionstate timeout is set to 60 seconds. 
 
  1. <configuration>  
  2. <system.web>  
  3. <sessionState mode="InProc" cookieless="true" timeout="60"/>  
  4. </sessionState>  
  5. </system.web>  
  6. </configuration>  
Second method:
 
Go to global.asax file and write the code below. This code sets the current session Timeout to 60 seconds.  
  1. void Session_Start(object sender, EventArgs e)  
  2. {  
  3. Session.Timeout = 60;  
  4. }  
Learn more about ASP.NET Session State here: Introduction to ASP.NET Sessions