WindowsImpersonationContext.Undo Méthode

Définition

Rétablit le contexte utilisateur à l’utilisateur Windows représenté par cet objet.

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

Exceptions

Une tentative est effectuée pour utiliser cette méthode à des fins autres que de rétablir l’identité en soi.

Exemples

L’exemple suivant montre comment emprunter l’identité d’un Windows à l’aide d’un jeton d’utilisateur spécifié.

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

S’applique à