WindowsIdentity.Impersonate() : WindowsIdentity « System.Security.Principal « C# / C Sharp by API






WindowsIdentity.Impersonate()

 

using System;
using System.Collections.Generic;
using System.IO;
using System.IO.IsolatedStorage;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security;
using System.Security.AccessControl;
using System.Security.Policy;
using System.Security.Permissions;
using System.Security.Principal;
using System.Text;

public class MainClass
{
    public static void Main()
    {
        WindowsIdentity identity = WindowsIdentity.GetCurrent();
        WindowsImpersonationContext context = identity.Impersonate();

        context.Undo();
    }
}

   
  








Related examples in the same category

1.WindowsIdentity.AuthenticationType
2.WindowsIdentity.GetCurrent()
3.WindowsIdentity.IsAnonymous
4.WindowsIdentity.IsAuthenticated
5.WindowsIdentity.IsGuest
6.WindowsIdentity.IsSystem
7.WindowsIdentity.Name
8.WindowsIdentity.Token