|
如何扮演另一个帐号(c#实现)
author:dahuaidan410
From:cnblogs
using directives#region Using directives using System; using System.Security.Principal; using System.Runtime.InteropServices; using System.Text.RegularExpressions; #endregion namespace Impersonal { class Program { 测试代码#region 测试代码 public static void Main(string[] args) { Console.WriteLine("当前用户是: " + WindowsIdentity.GetCurrent().Name); ImpersonatedWork testDel = new ImpersonatedWork(Test); ImpersonateAndDo("epro\\liping", "88888888", testDel); Console.WriteLine("当前用户是: " + WindowsIdentity.GetCurrent().Name); } static void Test() { Console.WriteLine("当前用户是: " + WindowsId [1] [2] [3] [4] [5] [6] [7] 下一页
|