据我所知,MVC 5配备了新的OWIN/ASP.NET身份认证位。在一个新的MVC 5项目的web.config文件,其实我注意到,FormsAuthenticationModule
被禁用
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
此外,还有是在App_Start文件夹名为Startup.Auth.cs创建一个新文件。在这个文件中的与“/帐号/登录”的默认登录路径
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
尝试更改为您的应用正确的路径是路径,CookieAuthenticationOptions
(新FormsAuthentication名称)的定义。或者,您无法使用新的ASP.NET标识位,并删除web.config中删除FormsAuthenticationModule
的行。
如果你不使用或想要使用新的身份验证选项,在您的应用程序的根目录中删除调用ConfigureAuth()
在Startup.cs
文件并删除上面的行中删除FormsAuthenticationModule
web.config中。这应该恢复预期的行为(同样,不知道你对默认代码做了多少定制)。
你可以添加'标签在你的web.config中? –
ekad
2014-09-22 07:35:51
奇怪的是,尝试搜索当前的“login”或“account/login”项目与“匹配全字”选项打勾。如果您的项目中没有任何地方提及“登录”或“帐户/登录”网址,则可能是IIS中的设置。 – ekad 2014-09-22 07:57:28