public class Program
{
public static void Main()
{
Uri baseUri = new Uri("http://localhost:7777/BasePath/");
Uri uri = new Uri(baseUri, "/controller");
Console.WriteLine(uri);
}
}
Is it the intend behavior to wipe /BasePath out from uri and the final result be http://localhost:7777/controller
?
I had to dig into the documentation for the constructor you're calling.
public Uri (Uri baseUri, string relativeUri);
Additionally, if the
relativeUri
begins with a slash, then it will replace any relative part of thebaseUri
.
It's the intended behavior. If you specify a relative path that begins with a slash, it assumes that the relative path is the entire relative path, so it discards any relative path already included in baseUri
.