我想让网站上的“记住时间”大约为一周。在默认的 mvc 3 应用程序中,我设置了以下更改:
<forms loginUrl="~/Account/LogOn" timeout="10880" slidingExpiration="true" />
但是,这还不够。半小时后网站忘记我了。可能出了什么问题?
最佳答案
您是否为表单例份验证票证设置了正确的超时,并且 isPercient
参数应设置为 true
。
FormsAuthenticationTicket tkt = new FormsAuthenticationTicket
(
1, // version
username, // user name
DateTime.Now, // issue date
expiration, // this should also be set to 10880
rememberMeChecked, // this should be true
null, // additional data
"/" // cookie path
);
有关更多信息,请参阅 here .
关于asp.net-mvc-3 - 表单例份验证超时不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11484405/