WindowsImpersonationContext.Undo Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
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()