In my application I need to search for a network path and do some processing based on the existence of the folder. Let us take an example, I have to search for a path on network and if path exists I have to enable some controls otherwise I need to disable the controls. I tried using DirectoryInfo object and getting the correct values:
DirectoryInfo dirInfo = new DirectoryInfo(@"\ServerIPAddress\FolderName");
if(dirInfo.Exists)
{
//do something
}
else
{
//do something else
}
The problem with the above code is it is consuming more than 2 minutes for getting the Exists property.
Is there any faster way to check for network path existence.
Thanks and regards,
Ashish Sharma