IIS Express - temporarily impersonate the authenticated user
===

According to this document:

>http://msdn.microsoft.com/en-us/library/ff647405.aspx

I've set the following in web.config

    <authentication mode="Windows" />
    <identity impersonate="false" />

And have also set this in the applicationhost.config for IIS Express 7.5


    <anonymousAuthentication enabled="false" userName="" />

    <windowsAuthentication enabled="true">
      <providers>
        <add value="Negotiate" />
        <add value="NTLM" />
      </providers>
    </windowsAuthentication>

But System.Threading.Thread.CurrentPrincipal.Identity still always equals the Windows identity of the authenticated user, i.e. not the account that IISExpress.exe is running under (my dev account).

To be clear, I'm logged-in as Account A and IIS Express runs as Account A, but I call my web service using Account B (setting the Credentials on HttpWebRequest) but the server-side code runs as Account B, i.e. the thread has this id and I can access network resources.

I'd like execution to occur as Account A (and on the prod server, as a service account) and only impersonate when I want it to.

Am I doing something wrong or is this area not perfectly implemented in IISX?

Thanks

Luke