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?

thanks

What code are you using? This thread has some info.

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?

thanks.
kk

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.