Reputation: 172468
I need to convert UNC paths to file:///
URLs. For example:
\\fileserver\share\dir\some file.ext --> file://///fileserver/share/dir/some%20file.ext
Is there a built-in function for this?
Upvotes: 13
Views: 16581
Reputation: 10582
Yes, use the Uri class in the System namespace:
Uri uri = new Uri(@"\\fileserver\share\dir\some file.ext");
string url = uri.AbsoluteUri;
Upvotes: 13