Asp.net MVC Session ends

3

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>

In my login controller:

FormsAuthentication.SetAuthCookie( agent.IDAgente.ToString() , false );
I'm not using MemberShip Provider

What happens:

Even if you set 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 might be causing this?

    
asked by anonymous 10.07.2014 / 03:10

3 answers

0

In short, .net 4.5 consumes twice as much memory as .net 3.5. If the server is not configured to cede this memory to the application, it simply "drops" active sessions to free memory.

This is something that neither the KingHost team knew how to answer, since they are experts in PHP but want to offer .NET.

A pity. But thank you very much @ user6026 and @Spectron

    
18.07.2016 / 15:31
0

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

Reference

10.07.2014 / 03:33
0

Make sure that the KingHost server does not have any timeout settings.

  

This time of the sessions may be related to the server and iis, I already had a site on a shared server where the sessions   crashed in 5 minutes or less, they had x available memory   for each site, when it reaches this memory, iis itself makes a   "recycle" to the pool that the site is associated with and clears all sessions,   then I moved the site to a vps and never had a problem again.

     

Have to see if your site is not consuming too much memory,   because in vps I got to have a site that was consuming a lot   memory (did not test data that came with get and gave error in   script, spending a lot of memory on the server), and after   problem was good.

source: link

    
12.04.2016 / 06:02