.NET中新的Uri(基本,相对)行为不正确 [英] Incorrect new Uri(base, relative) behaviour in .NET

查看:208
本文介绍了.NET中新的Uri(基本,相对)行为不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您像这样创建一个新的Uri:

  New Uri /test.php\"),\"?x=y)

它返回:

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

它应该返回:

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

不太确定RFC说的是什么)。



这是一个错误或是有任何其他功能,

解决方案

是的,它看起来像一个bug给我。特别是,我建议您在连接上报告此问题时,请参阅 RFC 1808 ,特别是第4节第5步和第5.1节:

 code>基数:http:// a / b / c / d; p?q#f 
相对:?y
绝对:http:// a / b / c / d; p?y

不知道解决问题的最佳方法,恐怕: p>

When you create a new Uri like this:

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 the every major browser out there (I'm not quite sure what RFC says though).

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?

解决方案

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 :(

这篇关于.NET中新的Uri(基本,相对)行为不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆