Asp.net mvc 饼干过期时间

Asp.net mvc 饼干过期时间,asp.net-mvc,cookies,owin,Asp.net Mvc,Cookies,Owin,我最近注意到,以下cookie的有效期为1年: CookieAuthenticationOptions cookieAuthenticationOptions = new CookieAuthenticationOptions() { Provider = new CookieAuthenticationProvider { OnResponseSignIn = (CookieResponseSignInContext context) =>

我最近注意到,以下cookie的有效期为1年:

CookieAuthenticationOptions cookieAuthenticationOptions = new CookieAuthenticationOptions()
{
    Provider = new CookieAuthenticationProvider
    {
        OnResponseSignIn = (CookieResponseSignInContext context) =>
        {
            context.CookieOptions.Expires = DateTime.UtcNow.AddMinutes(15);
        }
    }
};

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(cookieAuthenticationOptions);
app.UseOpenIdConnectAuthentication(openIdConnectAuthenticationOptions);
app.UseWindowsAzureActiveDirectoryBearerAuthentication(windowsAzureActiveDirectoryBearerAuthenticationOptions);
__请求验证登录 .AspNet.Cookies .openidconnect.nonce。[guid]

如果我添加以下代码,.AspNet.Cookies将具有所需的15分钟过期时间:

CookieAuthenticationOptions cookieAuthenticationOptions = new CookieAuthenticationOptions()
{
    Provider = new CookieAuthenticationProvider
    {
        OnResponseSignIn = (CookieResponseSignInContext context) =>
        {
            context.CookieOptions.Expires = DateTime.UtcNow.AddMinutes(15);
        }
    }
};

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(cookieAuthenticationOptions);
app.UseOpenIdConnectAuthentication(openIdConnectAuthenticationOptions);
app.UseWindowsAzureActiveDirectoryBearerAuthentication(windowsAzureActiveDirectoryBearerAuthenticationOptions);
但是,我不知道如何为其他cookie设置类似的过期时间