WindowsImpersonationContext.Undo 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将用户上下文还原到由此对象表示的Windows用户。
public:
void Undo();
public void Undo();
member this.Undo : unit -> unit
Public Sub Undo ()
例外
除了将标识还原为自我之外,还尝试使用此方法。
示例
以下示例演示如何使用指定的用户令牌模拟Windows标识。
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()