Click here to Skip to main content
11,922,587 members (30,464 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


11 bookmarked

Implement Impersonation in ASP.NET

, 2 Jan 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Implementing impersonation in ASP.NET.


One of our websites uses Impersonation and a specific user account with special permissions to access certain system resources. The first step in enabling impersonation is setting up the correct attributes in the web.config file:

<identity impersonate="true" password="xxxxxx" userName="xxxxxxx" />

By using the attribute impersonate="true", you are telling IIS that this website will be impersonating the configured user account.

Configure the website to use a specific user account

The next step is you need to go to IIS Manager and configure the user account you want to impersonate by this website.


  1. Open IIS Manager.
  2. Expand computer name.
  3. Expand websites.
  4. Click on the specific website for which you want to use impersonation.
  5. On the right panel, under the heading "IIS", double click "Authentication".
  6. Right click on "ASP.NET Impersonation" and select "Edit".
  7. Choose "Specific User".
  8. Click the SET button to provide the specific user name and password.

Press OK at the popup dialog to complete this step on enabling impersonation for website in IIS 7.0.

How to choose process identity for Application Pool in IIS 7.0

To set the correct user identity for the application pool, follow the steps below:

  1. Open IIS Manager.
  2. Click on "Application Pools" under the computer name.
  3. On the right panel, right click on the application pool name (your website’s relevant application pool).
  4. Select "Advanced properties".
  5. Select "Identity" under "Process Model".
  6. Click on the button to set the user account.
  7. Select "Custom account".
  8. Click on the button to specify the user account and password.
  9. Press "OK".

Recycle the app pool by right clicking on the application pool name and selecting "Recycle" on the right click context menu to ensure all configuration changes have taken place.

You are all set to use your application with the impersonated user account.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 1 Pin
Member 102493734-Sep-13 1:59
memberMember 102493734-Sep-13 1:59 
GeneralRe: My vote of 1 Pin
j0y2095-Sep-13 22:49
memberj0y2095-Sep-13 22:49 
GeneralRe: My vote of 1 Pin
Member 1024937310-Sep-13 23:25
memberMember 1024937310-Sep-13 23:25 
GeneralMy vote of 5 Pin
Maimonides30-Jul-13 21:52
professionalMaimonides30-Jul-13 21:52 
GeneralMy vote of 5 Pin
Purushotham Agaraharam25-Jul-13 0:17
groupPurushotham Agaraharam25-Jul-13 0:17 
GeneralMy vote of 4 Pin
sandeepkumarvemula11-Feb-13 23:29
membersandeepkumarvemula11-Feb-13 23:29 
GeneralRe: My vote of 4 Pin
j0y2096-Mar-13 21:42
memberj0y2096-Mar-13 21:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151125.1 | Last Updated 2 Jan 2013
Article Copyright 2013 by j0y209
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid