I have created a web application using Visual Studio 2010 on a Windows Server 2008 with the code as follows:
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Environment.UserDomainName.ToString() + " " + Environment.UserName.ToString();
}
I notice that when I debug / run the web application at the server, the user and the user domain is correctly display on the web application via the Label1 label box.
However, when I publish the web application to IIS and access it from a client machine. The user and the user domain is not display at all.
The client machine is connected to another domain and so I was wondering if this affect the code above from displaying the user name and the user domain at the client machine?
Appreciate any help offered.
Check this post below:
Getting a users DOMAIN/username from a web application
How can I get the domain name and username?
Best Regards