In Visual Studio, I created a completely new ASP.NET Web Forms application using the template it provided.
I did nothing for the code that VS generates automatically, except for adding to Global.asax.cs
string myself = System.Security.Principal.WindowsIdentity.GetCurrent().Name; string me = User.Identity.Name;
The string automatically saves my current Windows login ID. But string me is null, because when I debug, the user is null. However, Visual Studio does not detect errors before debugging.
How do I get the correct value for string me using User.Identity.Name?
source share