如何增加表单身份验证的时间

时间:2015-03-31 10:59:11

标签: c# asp.net

我对表单身份验证有一些疑问。如何在asp.net网站中增加表单身份验证的超时?在我的网站中,我设置了<forms loginUrl="Default.aspx" name=".ASPXAUTH" timeout="60000" protection="All">。但如果我们在15分钟后刷新页面,它会重定向到默认页面。你能告诉我任何一个,如何解决这个问题。

提前致谢!

2 个答案:

答案 0 :(得分:0)

如果要将超时值更改为更长,可以轻松更改本地web.config文件中的超时值(超时值以分钟为单位):

<system.web>
    <authentication mode="Forms">
          <forms timeout="50000000"/>
    </authentication>
</system.web>

答案 1 :(得分:0)

试试这样:

 <authentication mode="Forms">
  <forms loginUrl="~/Auth/SignOn.aspx" timeout="40" slidingExpiration="true" />
</authentication>

在旁注上,您应该TimeOut(Session) less than or equal to TimeOut(FormsAuthentication) * 2

相关问题