asp.net-mvc – Asp.net MVC Session termina

Question:

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" >
   </forms>
</authentication>

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?

Answer:

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.

Reference

Scroll to Top