WindowsImpersonationContext.Undo Metoda

Definicja

Przywraca kontekst użytkownika do użytkownika Windows reprezentowanego przez ten obiekt.

public:
 void Undo();
public void Undo ();
member this.Undo : unit -> unit
Public Sub Undo ()

Wyjątki

Podjęto próbę użycia tej metody do dowolnego celu innego niż przywrócenie tożsamości do siebie.

Przykłady

W poniższym przykładzie pokazano, jak personifikować tożsamość Windows przy użyciu określonego tokenu użytkownika.

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()

Dotyczy