HostingEnvironment.Impersonate Method ()


Impersonates the user represented by the application identity.

Namespace:   System.Web.Hosting
Assembly:  System.Web (in System.Web.dll)

[SecurityPermissionAttribute(SecurityAction.Demand, ControlPrincipal = true)]
public static IDisposable Impersonate()

Return Value

Type: System.IDisposable

An IDisposable object that represents the Windows user prior to impersonation; this object can be used to revert to the original user's context.

Exception Condition

The process cannot impersonate.

.NET Framework
Available since 2.0
Return to top