我想将FormsAuthentication cookie设置为超时但是VIA CODE

AJM*_*AJM 3 asp.net security forms-authentication

我想将FormsAuthentication cookie设置为超时但是VIA CODE.我知道我可以在web.config中执行此操作,但我想在数据库中进行配置.这可以通过代码吗?

<system.web>
        <authentication mode="Forms">
              <forms timeout="50000000"/>
        </authentication>
    </system.web>
Run Code Online (Sandbox Code Playgroud)

tva*_*son 5

为此,您需要创建自己的FormsAuthenticationTicket和cookie,并手动将其添加到响应中.请参阅链接页面上的示例.