How to determine if a network path is available or not (online or offline)?

.net, c#, networking, wmi

Solution

You can use `Directory.Exists` to check if a path exists.

bool folderExists = Directory.Exists(@"\\Path\To\Folder");

Problem

Using .NET / C#, how to determine if a network path (e.g. \mymachine\myfolder) is available or not (online or offline)? Is there a way to be notified by WMI of such event? Thanks!

Original source