不正确的新的URI(基地,相对)在.NET中的行为不正确、行为、基地、URI

2023-09-04 09:28:18 作者:爱伱丶此生不变

当你创建一个新的URI是这样的:

When you create a new Uri like this:

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

返回:

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

这应该返回:

It was supposed to return:

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

根据每一个主要的浏览器那里(的我不太知道RFC说,虽然的)。

这是一个bug或者有没有其他的功能,在那里其行为正确,也什么来解决它不重新发明轮子的最好方法是什么?

Is this is a bug or is there any other function out there which behaves correctly, also what's the best way to fix it without reinventing the wheel?

推荐答案

是的,它看起来像我的错误。具体而言,我建议,当您报告这方面的连接您参阅 RFC 1808 ,特别是第4节5步和第5.1节这个例子:

Yes, it looks like a bug to me. In particular, I would suggest that when you report this on Connect you refer to RFC 1808, in particular 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

不知道的最好的方式来解决这个问题,恐怕:(

Not sure about the best way to fix it, I'm afraid :(