您的位置:首页 > 其它

获取当前登录windows的帐号

2014-08-29 12:21 169 查看
System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
string strName1 = p.Identity.Name;
string strName2 = HttpContext.Current.User.Identity.Name.ToString();
string strName3 = Request.ServerVariables["AUTH_USER"]; //Finding with name
string strName4 = Request.ServerVariables[5]; //Finding with index


string domainName = System.Environment.UserDomainName;  //当前windows域IP
string userName = System.Environment.UserName.ToLower();   //当前登录帐号
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: