Asp.net Session Timeout

Asp.net Session Timeout

You can control the session timeout programmatically. Default it is 20 minutes and you can modify it inside web.config file of asp.net application.

Example of Session settings in Web.config file of asp.net application

<configuration>
<system.web>

  <sessionState timeout="50" />

</system.web>
</configuration>

On button click configure session timeout values.

public partial class _Default : System.Web.UI.Page
{

  protected void Button1_Click(object sender, EventArgs e)
  {
     Session.Timeout = 30;
  }
}

Session lost

By default, session get stored in worker process memory. On server if you have scenarios like WebGarden or WebFarm there are chances to get user session lost before timeout.

Read more here about Session state management

Tags:

Asp.net

How are you using session variables in Asp.net with C#.netIRequiresSessionState and sessionAsp.net SessionSessions In AspnetAsp.net Interview Questions for 2 years or 3 years experianceAsp.net Session AbandonSession application viewstateSession Loss In WebgardenWhat is web garden in Asp.net?How to implement Captcha in Asp.netasp net image upload

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.