1

i want to convert a network path (Directory "\www.dummy.com@ABC\test") to URI:

var uri = new Uri(path, UriKind.RelativeOrAbsolute);

It occures a URIFormatException

How can i fix this?

JohannesS
  • 11
  • 1

1 Answers1

1

I think you need to change UriKind enum to the Relative value. This code snippet is working fine:

const string path = @"\www.dummy.com@ABC\test";
var uri = new Uri(path, UriKind.Relative);
Console.Write(uri);

// Output:
// \www.dummy.com@ABC\test
Pozzi Userpic
  • 347
  • 8
  • 30