Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set infinity session time out in asp.net project

I'm working on asp.net project. how can I increase the session timeout? (infinity timeout) Or should I do this on IIS? If it is possible, please explain.

like image 347
Buddhika Samith Avatar asked Jul 06 '15 06:07

Buddhika Samith


People also ask

How do you set infinite session timeout?

The Timeout property can be set in the Web. config file for an application using the timeout attribute of the sessionState configuration element, or you can set the Timeout property value directly using application code. The Timeout property cannot be set to a value greater than 525,600 minutes (1 year).

How can set session timeout in ASP NET MVC?

Open the web. config file, then increase the value in minutes by using the time out attribute of SessionState element. By default, the session timeout value is 20 minutes.

How long does ASP.NET session last?

A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes.


1 Answers

You can set session timeout in web.config as shown below. The value is showing minutes, so you can set as long as you want, up until a year.

    <configuration>
      <system.web>
         <sessionState timeout="200"></sessionState>
      </system.web>
    </configuration>

The Timeout property can be set in the Web.config file for an application using the timeout attribute of the sessionState configuration element, or you can set the Timeout property value directly using application code.

The Timeout property cannot be set to a value greater than 525,600 minutes (1 year). The default value is 20 minutes.

like image 112
Shirish Avatar answered Sep 21 '22 09:09

Shirish