开发者

Get the username that runs the executing AppPool

开发者 https://www.devze.com 2023-01-05 06:50 出处:网络
In ASP.NET or WCF is it safe to use ServiceSecurityContext.Current.WindowsIdentity.Nameto get the current username that 开发者_JS百科executes the current thread?

In ASP.NET or WCF is it safe to use ServiceSecurityContext.Current.WindowsIdentity.Nameto get the current username that 开发者_JS百科executes the current thread?

I want to ensure that the correct user is impersonated in my WCF Service.


WindowsIdentity.GetCurrent().Name

is probably a better alternative, as I don't think that ServiceSecurityContext.Current is available in ASP.NET.

You may also want to consider

Thread.CurrentPrincipal.Identity.Name

if you care about the user instead of the process identity.

0

精彩评论

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

关注公众号