实体框架标识不改变cookie认证登录路径
本文关键字:认证 登录 路径 cookie 改变 框架 标识 实体 | 更新日期: 2023-09-27 18:08:27
我遇到了这个问题,我在代码中改变了de LoginPath,它仍然重定向到"Account/Login"
我代码:app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Acesso/Index"), //bit that I changed
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, Usuario>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
我从VS2013中的默认MVC身份验证应用程序中获取了此代码,这是我发现与未经授权访问后重定向相关的唯一地方。我错过了什么?
检查是否有WebMatrix.dll和/或WebMatrix.Data.dll在您的bin文件夹中,这两个库正在使用simplemember并导致问题。即使这些库没有在任何项目中引用