I am trying to extract the path of my PathString without the query parameters. So I did the following:
var ps = new PathString("/someapi/wayne/insane?param=1234&ups=134");
var u = new UriBuilder();
u.Path = ps;
// Built Uri: http://localhost/someapi/wayne/insane%3Fparam=1234&ups=134
u.Uri.GetComponents(UriComponents.Path, UriFormat.Unescaped).Dump();
// returns: "someapi/wayne/insane?param=1234&ups=134"
I'd have expected it will return: /someapi/wayne/insane
Is it supposed to work that way?
Is there another way to get just the path?
I found this: Get url without querystring, pointing out to use GetLeftPart
, which resulted in the same string.