Linux FormsAuthenticationTicket 能否在应用程序池回收后幸存下来?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3676995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:07:24  来源:igfitidea点击:

Can a FormsAuthenticationTicket survive an app pool recycle?

.netasp.netauthenticationformsauthenticationticket

提问by Gerrie Schenck

I am looking for a solution where we can make a FormsAuthenticationTicket (and corresponding cookie) with a very long expiration period. This is possible by setting a high value or using a sliding expiration, but when the application pool of the website is recycled, the FormsAuthenticationTicket disappears (I think), the cookie gets invalid and the user is asked to login again.

我正在寻找一种解决方案,我们可以在其中制作一个有效期很长的 FormsAuthenticationTicket(和相应的 cookie)。这可以通过设置高值或使用滑动过期来实现,但是当网站的应用程序池被回收时,FormsAuthenticationTicket 消失(我认为),cookie 变得无效并要求用户再次登录。

Is there any way around this?

有没有办法解决?

采纳答案by Darin Dimitrov

Set static machineKeysinstead of the auto generated. This way the FormsAuthenticationTicketwill survive app pool recycling.

设置静态machineKeys而不是自动生成的。通过这种方式,FormsAuthenticationTicket应用程序池回收将继续存在。