I want to display the windows user that the application is running as on a diagnostics page on my ASP.Net MVC database check page to help the user check whether they've setup their IIS correctly. Where can I find that information?
I tried System.Threading.Thread.CurrentPrincipal.Identity.Name but that appears to contain the logged in user by forms authentication, not the underlying windows user that the code is running as.
WindowsIdentity.GetCurrent().Name
You can use System.Environment.UserName
to get the windows user account that the application is running as.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With