相关疑难解决方法(0)

如何在用户点击注销按钮后让用户登录系统并注销?

我正在使用microsoft asp.net身份的自定义实现,因为我有自定义表,这就是为什么我已经给出了我的所有方法IUserStore和IUserPasswordStore的自定义实现.

问题是当用户登录然后在10-15分钟之后登录用户会话到期但我想要的是除非用户注销我想让用户登录系统.

码:

public partial class Startup
    {
        public void ConfigureAuth(IAppBuilder app)
        {
            app.CreatePerOwinContext(ApplicationDbContext.Create);
            app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
            app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                Provider = new CookieAuthenticationProvider
                {
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                        validateInterval: TimeSpan.FromMinutes(30),
                        regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
                }
            });            
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.UseTwoFactorSignInCookie(DefaultAuthenticationTypes.TwoFactorCookie, TimeSpan.FromMinutes(5));
        }
    }
Run Code Online (Sandbox Code Playgroud)

账户管理员:

[Authorize]
    public class AccountController : Controller
    {
        public AccountController()
            : this(new UserManager<UserModel>(new UserStore()))
        {
        }

        public AccountController(UserManager<UserModel> userManager)
        {
            UserManager = userManager;
        }
        public UserManager<UserModel> UserManager { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc owin asp.net-identity

13
推荐指数
1
解决办法
6350
查看次数

标签 统计

asp.net ×1

asp.net-identity ×1

asp.net-mvc ×1

c# ×1

owin ×1