|
using System;
using System.IO;
using Tools;
namespace ImpersonatorDemo
{
/// <summary>
/// Main class for the demo application.
/// Call this application with a low privileg account to test.
/// </summary>
class Program
{
/// <summary>
/// The main entry point.
/// </summary>
[STAThread]
static void Main( string[] args )
{
// Impersonate, automatically release the impersonation.
using ( new Impersonator( "yourUsername", "yourDomain", "yourPassword" ) )
{
// The following code is executed under the impersonated user.
string[] files = Directory.GetFiles( "c:\\windows" );
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.