System.Web.HttpContext.Current.User.Identity.Name
이 "null"을 반환합니다.null을 반환하는 HttpContext.Current.User.Identity.Name
확실히 로그인했습니다.
어떻게 해결할 수 있습니까?
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
if (Session["FirstName"] == null)
{
string loginName = System.Web.HttpContext.Current.User.Identity.Name;
string networkId = loginName.Split('\\')[1];
Session["FirstName"] = new AD_Utility().FirstName(networkId);
}
ViewBag.FirstName = Session["FirstName"];
}
[HttpContext.Current.User.Identity.Name은 항상 string.Empty입니다.] (http://stackoverflow.com/questions/1056487/httpcontext-current-user-identity-name- is-always-string-empty) –