Google

Monday, May 15, 2006

Impersonation


What is impersonation

Dictionary meaning of impersonation is - Pretending to be another person.

 

Through this definition we should have and idea (in light of asp.net) that impersonation loosely has to do something with identity interchange. Means, one user id is pretending to be another user id

 

Definition of impersonation from MSDN is –

 

"Impersonation is a means by which you can have the ASP.NET engine operates under the authenticated user's user account."

 

And

 

            "Impersonation is when ASP.NET executes code in the context of an authenticated and authorized client."

 

Why impersonation

 

By default, the ASP.NET engine operates under the ASPNET user account. But this account has limited access over the resources available on server

 

Sometimes you need to access network resources such as a file on a shared drive, which requires additional permissions.

 

Suppose, I have added following lines in my web.config file (my purpose in this article is to clear concept not the code, please refer to the links given blow for full blown coding examples)

 

<identity impersonate="true"

          userName="utsav"

          password="utsav123" />

 

now whenever a request to the IIS will be made for given app, my app can access all resources which account 'utsav' can access!

 

Following flow chart can clear few things –
 

 

Some twists

  • In asp, impersonation is enabled by default. Many times you use impersonation in asp.net just for the sake of backward compatibility.

0 Comments:

Post a Comment

<< Home