As I understand it, Windows Authentication is supposed to make it possible to fetch the domain and username of the currently-logged-on user. But I can't seem to get this to work. After I publish my project to my web server, and I load the page with a web browser:
If I use
Page.User.Identity.Name
in my code, then I get a blank string. If I try:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
in my code, then I get "NT AUTHORITY\NETWORK SERVICE", which is obviously incorrect.
In my project's web.config file under "<system.web>", it says
<authentication mode="Windows"></authentication>
...so I have every indication that WIndows Authentication is being set. So, what am I doing wrong?