1

I am trying to get my IIS 7.5 to impersonate the account of the user accessing a site through a browser.

If I use...

    <identity impersonate="true" userName="mydomain\myusername" password="mypassword" />

it works just fine. However, if I use...

    <identity impersonate="true" />

It won't pick up the user. Am I missing some code? Or is this an IIS 7.5 configuration issue?

John Livermore
  • 30,235
  • 44
  • 126
  • 216
  • You are using always IE? I also think you have to enable this in the IIS itself – sra May 12 '11 at 22:24

4 Answers4

3

I posted a previous answer, but I think this one applies better

Try to select if you are using a specific user or pass through. Not 100% sure if this solves your problem, just trying to help!

pass through or user specific

xmorera
  • 1,933
  • 3
  • 20
  • 35
  • I checked this dialog and mine looks just like the picture. Thanks for the tip though! – John Livermore May 17 '11 at 14:16
  • The article linked below states "Impersonation enabled. In this instance, ASP.NET impersonates the token passed to it by IIS, which is either an authenticated user or the anonymous Internet user account (IUSR_machinename)." I am getting the anonymous Internet user account, and not the authenticated user. How do I make it pick up the user and not the anonymous user? – John Livermore May 17 '11 at 14:28
2

On the enabling impersonation, check what types of security you have enabled:

  • Open IIS

  • Go to your site, click on it

  • Click on authentication (a blue guy with a lock icon)

  • Make sure you have ASP.NET impersonation enabled

Impersonation should be enabled

Enable impersonation

xmorera
  • 1,933
  • 3
  • 20
  • 35
  • 2
    This does exactly the same thing as in the question – Jimmie R. Houts May 12 '11 at 22:53
  • 1
    Oh right, I misread the question. The problem is not authentication, it is that it is not picking up current user. That is different, he needs to configure if it is passthrough security or specify a user. I will write a different response. – xmorera May 13 '11 at 14:41
1

You have to configure IIS to pass the security token to ASP.NET. See here

enamrik
  • 2,292
  • 2
  • 27
  • 42
  • Thanks for the link. The article states "Impersonation enabled. In this instance, ASP.NET impersonates the token passed to it by IIS, which is either an authenticated user or the anonymous Internet user account (IUSR_machinename)." I am getting the anonymous Internet user account, and not the authenticated user. How do I make it pick up the user and not the anonymous user? – John Livermore May 17 '11 at 14:26
  • Just a followup, from my testing if Anonymous Authentication is enabled, IIS *ALWAYS* picks up the anonymous user. Only by disabling Anonymous Auth was I able to get IIS to pick up the active directory user (me). – John Livermore May 24 '11 at 14:24
  • @John I'm having a problem where I'm prompted for my User/Pass whenever I try to hit my site. I have Windows Auth and ASP.NET Impersonation enabled with others disabled. Works fine in the Cassini web host but not in IIS7. Did you end up getting this working? – kingdango Dec 01 '11 at 02:26
0

Did you try turning on Windows Authentication?

Jimmie R. Houts
  • 7,728
  • 2
  • 31
  • 38