Incorrect NTLoginName
I need to find the NTLoginID of the currently logged in user on a Web Site, preferably using C#. I have tried several different methods and all work fine locally, but do not on my server. Below, I have what I have tried, as well as the response I got from the server. For everything I tried locally, I either got the Domain\NTLoginID or just the NTLoginID.
System.Windows.Forms.SystemInformation.UserName.To String()
Server: NETWORK SERVICE
Page.User.Identity.Name.ToString()
Server:
Request.Params["AUTH_USER"].ToString()
Server:
Convert.ToString(Request.ServerVariables["REMOTE_USER"])
Server:
User.Identity.Name.ToString()
Server:
System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString()
Server: NT AUTHORITY\NETWORK SERVICE
WindowsPrincipal wpUser = (WindowsPrincipal)System.Threading.Thread.CurrentP rincipal;
wpUser.Identity.Name.ToString():
Server:
How can I get at least one of these (or find another way) to give the correct domain/username or just the username?
|