Hi all,
I am writing one application using c# in which firstly I m getting impersonating the user and then i want to retrieve mapped Drives.
But issue is when I am calling method in following sequence:
1. create object of class
2. call mappeddrives() method
3. call impersonate method
then its working fine.
But if i m calling impersonate method before calling mappeddrives() then its not giving me list of mapped drives.
my code for getting mapped drives is :
public string MappedDrives()
{
string drives = "";
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo dirInfo in allDrives)
{
if (dirInfo.DriveType.ToString() == "Network")
drives += dirInfo.Name+"?";
}
return drives;
}
Can anyone tell me the reason behind this?
Thanks,
Anu