开发者

Howto programmatically determine ASP.Net worker process account

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜