Howie Howie - 3 years ago 78
C# Question

Exception: "URI formats are not supported"

I have an absolute local path pointing to a dir:

"file:\\C:\\Users\\john\\documents\\visual studio 2010\\Projects\\proj"

But when I try to throw it into
's ctor I get the "URI formats are not supported" exception.

I googled and looked on SO, but I only see solutions with remote paths, not local ones. I'd expect a conversion method of some sort...

Answer Source
string uriPath =
    "file:\\C:\\Users\\john\\documents\\visual studio 2010\\Projects\\proj";
string localPath = new Uri(uriPath).LocalPath;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download