Why really short timeout in ASP.NET MVC?

后端 未结 2 1231
攒了一身酷
攒了一身酷 2021-01-31 18:52

I have an MVC 2 application where the timeout is set to 2880 (minutes as I understand it, but even if it is seconds there\'s a problem):



        
相关标签:
2条回答
  • 2021-01-31 19:21

    2880 is given in minutes. It will logout automatically if you add slidingExpiration="true". See example below.

     <forms loginUrl="~/Account/LogOn" timeout="2880" slidingExpiration="true"/>
    
    0 讨论(0)
  • 2021-01-31 19:23

    Found the answer finally after a lot of Googling...

    You have to set a custom machinekey in the web.config file. I used this generator:

    http://aspnetresources.com/tools/machineKey

    This seems to have to do something with "recycling" on the web host, which causes the user to be logged off, if I understood it correctly.

    Anyway, it works fine now!

    0 讨论(0)
提交回复
热议问题