Incorrect new Uri behavior (basic, relative) in .NET.

When you create a new Uri as follows:

New Uri(New Uri("http://example.com/test.php"),"?x=y") 

it returns:

 http://example.com/?x=y 

It was supposed to return:

 http://example.com/test.php?x=y 

according to every major browser (I'm not quite sure what the RFC says, though).

Is this a mistake or is there any other function that behaves correctly, and also what is the best way to fix it without reinventing the wheel?

+6
constructor uri
source share
1 answer

Yes, that seems like a mistake. In particular, I would suggest that when you report this to Connect , you are referencing RFC 1808 , specifically section 4, step 5 and section 5.1 with this example:

 Base: http://a/b/c/d;p?q#f Relative: ?y Absolute: http://a/b/c/d;p?y 

I do not know how best to fix this, I'm afraid :(

+6
source share

All Articles