Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 会话过期时如何重定向到登录页asp.net MVC 5 asp.net Identity 2.0_Asp.net Mvc_Asp.net Mvc 5_Asp.net Identity - Fatal编程技术网

Asp.net mvc 会话过期时如何重定向到登录页asp.net MVC 5 asp.net Identity 2.0

Asp.net mvc 会话过期时如何重定向到登录页asp.net MVC 5 asp.net Identity 2.0,asp.net-mvc,asp.net-mvc-5,asp.net-identity,Asp.net Mvc,Asp.net Mvc 5,Asp.net Identity,我已使用最新的ASP.net Identity 2.0在VS2013中创建了默认webproject。我想知道需要什么设置来更改日志会话的超时,以便我可以进行实际测试。您可以在Startup.Auth.cs中跳过此设置 // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily

我已使用最新的ASP.net Identity 2.0在VS2013中创建了默认webproject。我想知道需要什么设置来更改日志会话的超时,以便我可以进行实际测试。

您可以在Startup.Auth.cs中跳过此设置

        // Enable the application to use a cookie to store information for the signed in user
        // and to use a cookie to temporarily store information about a user logging in with a third party login provider
        // Configure the sign in cookie
        app.UseCookieAuthentication(new CookieAuthenticationOptions
        {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login"),
            Provider = new CookieAuthenticationProvider
            {
                OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    validateInterval: TimeSpan.FromMinutes(1),
                    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
            },

            //*** This will override the default **** 
            ExpireTimeSpan = TimeSpan.FromMinutes(1)

        });