Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase Session timeout in MVC 3

I have an ASP.NET MVC 3 (Razor) Application and I am faced with frequent session timeouts.
Is there a way to increase the value of the session?

like image 684
sandeep Avatar asked Jun 29 '11 11:06

sandeep


People also ask

How do I increase my session timeout?

Click Servers > Server Type > WebSphere Application Servers > CongnosX_GW2. Click Container Settings > Session management > Set Timeout. Enter the desired timeout value in minutes. Click OK.

How can increase 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. Also in your case if you are using forms authentication, please check the timeout value.

What is the default session timeout in MVC?

The default is 20 minutes.


2 Answers

You're not providing enough details, such as your configuration, description of the problem etc.

What's happening more exactly? This article may help: Random Session Timeout in ASP.NET MVC3
If not, you could use a configuration like this in your web.config file :

<configuration>   ...   <system.web>     <sessionState mode="InProc" timeout="30" />   </system.web>   ... </configuration> 

Here the session timeout is being set to 30 minutes, for example.

like image 113
Tomasz Jaskuλa Avatar answered Oct 07 '22 07:10

Tomasz Jaskuλa


In web.config:

<sessionState mode="InProc" timeout="20"/>

You have to change the value of timeout attribute.

like image 29
Egor4eg Avatar answered Oct 07 '22 07:10

Egor4eg