1
votes

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 possibly 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.

1

1 Answers

0
votes

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.