Hi there
My web application is a product which has to deploy to a variety of web servers. Is there a way to determine the account name that the .Net worker process account is using at runtime?
Using .Net 3.5, C#
Thanks in advance
-Pete
Hi there
My web application is a product which has to deploy to a variety of web servers. Is there a way to determine the account name that the .Net worker process account is using at runtime?
Using .Net 3.5, C#
Thanks in advance
-Pete
Have you tried System.Environment.UserName
?
Edit:
You're right, the environment username doesn't seem to work. Here's something else you could try, which I've tested on IIS 7 / Windows Vista:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Returns "NT AUTHORITY\NETWORK SERVICE" for me since my default app pool runs as network service.