我想检查使用Windows身份验证的用户的登录名。 我有这个作为我的控制器的构造函数:MVC中的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" />
什么想法?
我仍然得到空... –
您可能尚未将您的Web服务器配置为需要Windows身份验证。 –
Im使用Casini ... –