我遇到了这个问题,我在代码中更改了de LoginPath,它仍然重定向到“帐户/登录”
我的代码:
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身份验证应用程序中获取此代码,这是我发现与未经授权的访问后重定向相关的唯一地方。我错过了什么?
答案 0 :(得分:1)
检查 WebMatrix.dll 和/或 WebMatrix.Data.dll > bin 文件夹,这两个库正在使用SimpleMembership并导致问题。即使这些库在解决方案的任何项目中都 NOT REFERENCED 。