HostingEnvironment.Impersonate Method (IntPtr)
.NET Framework (current version)
Impersonates the user represented by the specified user token.
Assembly: System.Web (in System.Web.dll)
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)] public static IDisposable Impersonate( IntPtr token )
Parameters
- token
-
Type:
System.IntPtr
The handle of a Windows account token.
Return Value
Type: System.IDisposableAn 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 |
|---|---|
| HttpException | The process cannot impersonate. |
.NET Framework
Available since 2.0
Available since 2.0
Show: