【问题标题】:Why is web user authenticated through NTLM?为什么 Web 用户通过 NTLM 进行身份验证?
【发布时间】:2012-10-09 18:38:39
【问题描述】:

我正在使用表单身份验证并从 Visual Studio 2010 启动一个站点。它使用的是 Visual Studio 开发 (web) 服务器而不是 IIS。 web.config 有:

<authenticaion mode="Forms">
  <forms name=".MyApp" protection="All" cookieless="UseCookies"/>
</authentication>

登录页面正在使用 ASP.NET 登录控件。在用户登录之前,我可以看到以下内容:

HttpContext.Current.Request.LogonUserIdentity.AuthenticationType == "NTLM"
HttpContext.Current.User.Identity == System.Security.Principal.GenericIdentity
HttpContext.Current.User.Identity.AuthenticationType == "NTLM"

这个用户似乎被认证为本地系统用户而不是网络用户。这是否意味着用户将始终通过身份验证,无论他们是否登录该站点?

网络用户 NTLM 怎么样?

【问题讨论】:

  • 您在 IIS 中的身份验证设置是什么样的?
  • Request.LogonUserIdentity 表示 IIS 的运行方式。
  • @Erix:如上所述,我没有使用 IIS。
  • @Daniel,有没有办法通过表单身份验证来验证网络用户的身份验证?或者它不处理那个?
  • 这似乎是答案stackoverflow.com/questions/833786/…。 Page.User.Identity.IsAuthenticated

标签: c# asp.net .net visual-studio-2010


【解决方案1】:

据我所知,cassini 不支持 Windows 身份验证。

它作为本地系统帐户运行,这就是您所看到的 NTLM 身份验证。

如果您正在为 Asp.Net 应用程序(或 WCF)开发/调试安全功能,我强烈建议您部署到 IIS。

【讨论】:

  • 你们(和@EdSF)都发布了类似的好答案。不知道该接受谁。
【解决方案2】:

如果我没记错的话,当您使用 VS 进行调试并且它是开发服务器时,您会看到 yourself 是运行 Visual Studio(在您的用户上下文中)的 User(经过身份验证)。

Visual Studio 在您的上下文中运行(您的 Windows 用户帐户/权限等) - Request.LogonUserIdentity.User

它不应该影响您对 Web 表单/表单身份验证的调试。 Forms Auth登录成功后,可以获得“forms auth user”(web用户)的HttpContext.User.Identity.Name

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-18
    • 2018-04-29
    • 2015-03-14
    • 1970-01-01
    • 2015-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多