– MVC Session termina


I have an ASP.NET MVC 4.0 application on a KingHost server. In my web.config I do the following:

<sessionState timeout="1000"></sessionState>  
   <authentication mode="Forms">     
       <forms loginUrl="~/Login" timeout="1000" >

On my login controller:

FormsAuthentication.SetAuthCookie( agent.IDAgente.ToString() , false );

Note: I am not using MemberShip Provider

What happens:

Even setting the timeout to 1000 (almost a day) after 2 minutes of browsing the session drops. What I use to fetch session data is: HttpContext.Current.Session["variavel"] .

What could be causing this?


Put in your timeout="30" which is 30 minutes, the Microsoft MSDN Site Reference says that: "The Timeout property cannot be set to a value greater than 525,600 minutes (1 year). The default value is 20 minutes. " , that must be the problem, because you have exceeded the maximum allowed which is 525,600 . Just remembering that the value is in minutes.


Scroll to Top