【发布时间】:2012-09-23 13:59:47
【问题描述】:
我想使用 Windows 身份验证检查用户的登录名。 我有这个作为我的控制器的构造函数:
public class HomeController : BaseController
{
public string UserIdentityName;
public HomeController()
{
UserIdentityName = System.Web.HttpContext.Current.User.Identity.Name;// HttpContext.Current.User.Identity.Name;
}
}
但 UserIdentityName 返回空字符串...
我的 web.config 中也有这个:
<authentication mode="Windows" />
有什么想法吗?
【问题讨论】:
标签: asp.net-mvc authentication asp.net-mvc-4 windows-authentication