Export (0) Print
Expand All

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.

ExceptionCondition
HttpException

The process cannot impersonate.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft