On the Visual Studio environment, during debugging I am retrieving the proper username through the familiar c# code line below:
WindowsIdentity.GetCurrent().Name;
However when I publish the project to the Server on Windows 2008 R2 with IIS 7.5, it returns me NT AUTHORITY\SYSTEM
I have configured web.config to use <authentication mode="Windows" />
Utilizing the Application Pool that is configured to use Integrated mode with Identity set to LocalSystem
And on the IIS for the virtual folder, I have disabled Anonymous Auth and set Enable to Windows Auth.
This is the first time that this company is being set for Microsoft development and hence struggling to set up the environment correctly.
What am I missing to get the code to work? OR perhaps, what is a better code that would return me the Window NY Authentication user? One more thing: If I hardcode the strUserName, the rest of the code to extract the User FullName works and works fine. So AD works.
Spent about a day or two to resolve this issue, any help will be appreciated. Thanks,