ASP.NET Impersonation for a specific user

Impersonation is the way to control the identity that is used to execute the application. By default impersonation is disabled and the default ASPNET account is used for that purpose.

However it is possible to enable impersonation so that the application can be run by a different user with different permission levels. To enable impersonation you can edit the web.config file and change the line,

<identity impersonate="false" /> to that of
<identity impersonate="true" />.

This will enable impersonation. If you want to run the application as a different user, you can do so by using the following code,

<identity impersonate="true" username="user_name" password="user_password" />

Impersonation is usually used to control access to the resources available. Care must be taken while implementing impersonation since some of the user might have administrative privileges.

With such permission they might have access to all resources which might be undesirable. So use impersonation with care when you are implementing it for a particular user.







______________________________________________________

Recommended Resource



| Security in .NET Impersonation | ASP.NET Impersonation for a specific user | Implementing Impersonation in ASP.NET | Identity Impersonation in .NET | How to Enable and Disable Impersonation in ASP.NET |



_______________

FREE Subscription

Stay Current With the Latest Technology Developments Realted to .NET. Signup for Our Newsletter and Receive New Articles Through Email.

Name:

Email:

Note : We never rent, trade, or sell our email lists to anyone. We assure that your privacy is respected and protected.


 

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2017 - All Rights Reserved.