我有一个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"/>
这解决了我的问题 – Windows身份验证现在可以按预期工作,并且没有更多的重定向到不存在的登录页面.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。