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

我有一个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身份验证现在可以按预期工作,并且没有更多的重定向到不存在的登录页面.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....