我想檢查使用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 ... –