开发者

ASP.NET - Impersonation not working

开发者 https://www.devze.com 2023-03-03 18:29 出处:网络
I\'m trying to ensure my ASP.NET 4.0 application runs under an administritive account. I\'ve got this in my web.config:

I'm trying to ensure my ASP.NET 4.0 application runs under an administritive account. I've got this in my web.config:

<identity impersonate="true" userName="Admin" password="myadminpassword"/>

'Admin' is the local administrator account on my server (Windows Server 2003 SP2, running IIS6).

But, 'SYSTEM' still gets returned from Environment.UserName when I run it.

Am I doing something incorrectly, is there anyway to verify that the impersonation is actually working? This is p开发者_运维问答ossibly the cause of a wider issue I'm seeing, so I want to ensure that I'm using impersonation correctly.

Update

I've also tried outputting

System.Security.Principal.WindowsIdentity.GetCurrent().Name

But, this also returns 'NT AUTHORITY\SYSTEM' as the username so it looks like impersonation isn't working or something is over-riding my web.config?

Thanks.


As this is an internally facing application, I just set the Identity of the Application Pool to the account I want to run under - this resolved my issues.

0

精彩评论

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

关注公众号