views:

54

answers:

2

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.

+4  A: 
WindowsIdentity.GetCurrent().Name
Nissan Fan
+2  A: 

You can use System.Environment.UserName to get the windows user account that the application is running as.

womp
+1 since that's another option. It appears that it doesn't append the domain but it's probably useful in some situations.
Colin Newell