Hi all,

When i run my application on mysystem/localhost it gives me correct username. but when i host my application on IIS and then open application on other user's pc then it should show that pc's username. but it doesn't.

how to retrieve username of that pc?


Hi pritaeas,

i had used below codes to get username after hosting site on IIS.

if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
                string userName = "Hello, " + System.Web.HttpContext.Current.User.Identity.Name;

string ddd = System.Net.Dns.GetHostName();

string s = Page.User.Identity.Name;

string sss= System.Environment.UserName;

string test= HttpContext.Current.Request.LogonUserIdentity.ToString();

except these are there any other solutions?


On the IIS server, Did you disable "Anonymous Authentication" and enabled "Windows Authentication" for that website?