Using .NET / C #, how to determine if a network path is available (e.g. \ mymachine \ myfolder) or not (online or offline)? Is there any way to get WMI from such an event?
Thanks!
You can use Directory.Exists to check if the path exists.
Directory.Exists
bool folderExists = Directory.Exists(@"\\Path\To\Folder");
Perhaps try the Ping class:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx
It will tell you if the host is available, but I donโt know if it will tell you if any specific share / path is available.
Just try using it. This will result in an error if it is not. You should still code this condition: why do it twice?