|
UserInfoEndImpersonation Method
|
Ends the impersonation of the specified user.
Namespace: GSF.IdentityAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax 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