加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – MVC网站转发到/ Account / Login,只启用Windows

发布时间:2020-12-15 23:02:38 所属栏目:asp.Net 来源:网络整理
导读:我有一个MVC3网站设置只启用 Windows身份验证(所以匿名和表单被禁用).每当我尝试点击默认页面,有些东西转发到这个URL; …/MyApp/Account/Login?ReturnUrl=%2fMyApp%2f 我收到一个错误 The resource cannot be found. Description: HTTP 404. The resource yo
我有一个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身份验证现在可以按预期工作,并且没有更多的重定向到不存在的登录页面.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读