ASP.NET中HttpContext.Current.User.Identity.Name为null时,如何处理用户身份验证问题?

2026-03-30 12:251阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计258个文字,预计阅读时间需要2分钟。

ASP.NET中HttpContext.Current.User.Identity.Name为null时,如何处理用户身份验证问题?

我正在尝试使用`HttpContext.Current.User.Identity.Name`从内部网络获取用户的Windows登录详细信息,但它是空的。我已经尝试在Web.Config中更改身份验证模式,但没有效果。在`system.web`中设置了`authentication`。

我正在尝试使用HttpContext.Current.User.Identity.Name从内部网络获取用户的 Windows登录详细信息,但它是空的.

我已经尝试在Web.Config中更改身份验证模式,但没有任何乐趣:

<system.web> <authentication mode="Windows" /> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web>

我还听说在项目属性中你应该启用Windows身份验证并禁用匿名身份验证,如下所示:

但后来我得到了一个重定向循环,在Chrome中显示“此网页有重定向循环”的消息.

我还检查过我的机器上安装了Windows身份验证:

有关如何解决此问题的任何想法吗?

非常感谢

ASP.NET中HttpContext.Current.User.Identity.Name为null时,如何处理用户身份验证问题?

当我有:

<authentication mode="Windows"/> <identity impersonate="true/>

在web.config中我得到当前用户:

string currUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

本文共计258个文字,预计阅读时间需要2分钟。

ASP.NET中HttpContext.Current.User.Identity.Name为null时,如何处理用户身份验证问题?

我正在尝试使用`HttpContext.Current.User.Identity.Name`从内部网络获取用户的Windows登录详细信息,但它是空的。我已经尝试在Web.Config中更改身份验证模式,但没有效果。在`system.web`中设置了`authentication`。

我正在尝试使用HttpContext.Current.User.Identity.Name从内部网络获取用户的 Windows登录详细信息,但它是空的.

我已经尝试在Web.Config中更改身份验证模式,但没有任何乐趣:

<system.web> <authentication mode="Windows" /> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web>

我还听说在项目属性中你应该启用Windows身份验证并禁用匿名身份验证,如下所示:

但后来我得到了一个重定向循环,在Chrome中显示“此网页有重定向循环”的消息.

我还检查过我的机器上安装了Windows身份验证:

有关如何解决此问题的任何想法吗?

非常感谢

ASP.NET中HttpContext.Current.User.Identity.Name为null时,如何处理用户身份验证问题?

当我有:

<authentication mode="Windows"/> <identity impersonate="true/>

在web.config中我得到当前用户:

string currUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();