WindowsImpersonationContext.Undo Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reverts the user context to the Windows user represented by this object.
public:
void Undo();
public void Undo ();
member this.Undo : unit -> unit
Public Sub Undo ()
Exceptions
An attempt is made to use this method for any purpose other than to revert identity to self.
Examples
The following example shows how to impersonate a Windows identity using a specified user token.
WindowsImpersonationContext^ ImpersonationCtx = WindowsIdentity::Impersonate( userToken );
//Do something under the context of the impersonated user.
ImpersonationCtx->Undo();
WindowsImpersonationContext ImpersonationCtx = WindowsIdentity.Impersonate(userToken);
//Do something under the context of the impersonated user.
ImpersonationCtx.Undo();
Dim ImpersonationCtx As WindowsImpersonationContext = _
WindowsIdentity.Impersonate(userToken)
'Do something under the context of the impersonated user.
ImpersonationCtx.Undo()
Applies to
Bekerjasama dengan kami di GitHub
Sumber untuk kandungan ini boleh didapati di GitHub, di mana anda juga boleh mencipta dan menyemak isu dan menarik permintaan. Untuk maklumat lanjut, lihat panduan penyumbang kami.