开发者

Howto programmatically determine ASP.Net worker process account

开发者 https://www.devze.com 2022-12-27 02:58 出处:网络
My web application is a product wh开发者_如何转开发ich 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?

My web application is a product wh开发者_如何转开发ich 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消