I used a dll from this site http://www.codeproject.com/Articles/14358/User-Impersonation-in-NET
Now what I'm trying to do is to access the remote directory and get its files. Whenever i tried doing this there is no error but when I'm trying to debug it the impersonation is null and there are no token so maybe you can give me insights about this tnx!.
ImpersonateUser imp = new ImpersonateUser();
try
{
imp.Impersonate("bla", "bla", "bla");
try
{
string[] files = Directory.GetFiles(@"\\servername\folder", "*.txt");
foreach (string file in files)
{
Console.WriteLine(file);
}
}
catch
{
}
finally
{
}
}