|
UserInfoEndImpersonation Method
|
Ends the impersonation of the specified user.
Namespace: GSF.IdentityAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.253-beta+ffb7163c9e3b771705bc5b9aa3f09870f2cb9e2c
Syntaxpublic static void EndImpersonation(
WindowsImpersonationContext impersonatedUser
)
Public Shared Sub EndImpersonation (
impersonatedUser As WindowsImpersonationContext
)
public:
static void EndImpersonation(
WindowsImpersonationContext^ impersonatedUser
)
static member EndImpersonation :
impersonatedUser : WindowsImpersonationContext -> unit
GSF.Identity.UserInfo.EndImpersonation = function(impersonatedUser);
View SourceParameters
- impersonatedUser WindowsImpersonationContext
- WindowsImpersonationContext of the impersonated user.
Example
This example shows how to terminate an active user impersonation:
using System;
using System.IO;
using System.Security.Principal;
using GSF.Identity;
class Program
{
static void Main(string[] args)
{
WindowsImpersonationContext context = UserInfo.ImpersonateUser("XYZCorp", "johndoe", "password");
Console.WriteLine(File.ReadAllText(@"\\server\share\file.xml"));
UserInfo.EndImpersonation(context);
Console.ReadLine();
}
}
See Also