Impersonation is the concept whereby an application executes under the \context of the identity of the client that is accessing the \application. This is achieved by using the access token provided by \IIS. Can impersonate entire website by editing the web.config or impersonate chunks of code in the codebehind.Very usefull when accessing folders on a remote server that has no domain
Imports System.Runtime.InteropServices
Imports System.Security.Principal
Imports System.Web.Security
using System.Runtime.InteropServices;
using System.Security.Principal;
Whatever chunk you want to impersonate, just use
if(impersonateValidUser("administrator", "dyna-web2", "password"))
{
//do stuff with impersonated users here
}
undoImpersonation();