gpt4 book ai didi

asp.net-mvc-5 - Windows 身份验证在 ASP.NET MVC 5 Web 应用程序中不起作用

转载 作者:行者123 更新时间:2023-12-03 20:18:49 24 4
gpt4 key购买 nike

我有一个 ASP.NET MVC 5 应用程序,正在尝试启用 Windows 身份验证。开发机器为Windows Server 2008 R2、IIS Express 8.0、Visual Studio 2013 & .NET Framework 4.5。

每当我浏览应用程序时,我都会收到 404 Not Found 错误。应用程序使用 进入重定向循环http://localhost:63455/Account/Login?ReturnUrl=%2F .终于ReturnUrl最终变得非常大,因为它被附加到每个重定向。

我的 web.config 看起来像这样:

  <system.web>
<authentication mode="Windows"/>
</system.web>

我试过设置 匿名认证 Windows 身份验证 开发服务器属性上的设置。

Development Server Properties

我也尝试添加以下 appSettings :
<add key="autoFormsAuthentication" value="false"/>
<add key="enableSimpleMembership" value="false"/>

如何让 Windows 身份验证正常工作?

最佳答案

ConfigureAuth Startup.Auth.cs 中的方法包含需要为 删除的以下代码Windows 身份验证 .

代码用于表单认证 OWIN .

        // 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")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

关于asp.net-mvc-5 - Windows 身份验证在 ASP.NET MVC 5 Web 应用程序中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23260283/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com