我有一个MVC3网站设置只启用
Windows身份验证(所以匿名和表单被禁用).每当我尝试点击默认页面,有些东西转发到这个URL;
…/MyApp/Account/Login?ReturnUrl=%2fMyApp%2f
我收到一个错误
The resource cannot be found. Description: HTTP 404. The resource you
are looking for (or one of its dependencies) could have been removed,
had its name changed,or is temporarily unavailable. Please review
the following URL and make sure that it is spelled correctly.Requested URL: /MyApp/Account/Login
我的web.config中没有任何配置来查找此URL,但有一部分使用我删除的表单认证;
<authentication mode="Forms"> <forms loginUrl="~/Account/logon" timeout="2880" /> </authentication>
我应该重新配置此设置,而不是彻底删除?我试过加入
<authentication mode="Windows"></authentication>
但它仍然转回到同一个地方.这里有什么额外的东西吗?
解决方法
好的,所以我遇到了以下文章:
http://martinnormark.com/asp-net-mvc-3-windows-authentication-problem-redirects-to-account-login
并从那里,我在应用设置部分中将以下密钥添加到我的web.config中:
<add key="autoFormsAuthentication" value="false" /> <add key="enableSimpleMembership" value="false"/>