增加生命的时间Asp.net身份验证cookie [英] Increase life time for Asp.net authentication cookie

查看:152
本文介绍了增加生命的时间Asp.net身份验证cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个下code设置验证cookie的:

I used this following code to set authenticate cookie :

System.Web.Security.FormsAuthentication.SetAuthCookie(Profile.Email, true);

我的问题是如何提高生命周期此身份验证cookie?

my question is how I can increase life-time for this authentication cookie ?

推荐答案

超时设置主要是在web.config文件中,你可以做在code,但我不会建议吧。

The timeout is set primarily in the web.config file, you can do it in code but I wouldn't advise it.

这是默认设置,你可以看到的以分钟为单位的超时值。

These are the default settings, you can see the timeout value that's specified in minutes.

<system.web>
  <authentication mode="Forms">
    <forms loginUrl="Login.aspx"
           protection="All"
           timeout="30"
           name=".ASPXAUTH" 
           path="/"
           requireSSL="false"
           slidingExpiration="true"
           defaultUrl="default.aspx"
           cookieless="UseDeviceProfile"
           enableCrossAppRedirects="false" />
  </authentication>
</system.web>

这篇关于增加生命的时间Asp.net身份验证cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆