thirdRelativeUriが失敗するのはなぜですか?これは.NETのバグですか? 4.0でも修正されていないようです。Uriコンストラクタ.NET Frameworkバグ?
var googleU = new Uri("http://www.google.com");
var secondRelativeUri = new Uri(googleU,"//test.htm"); // doesn't fail
var thirdRelativeUri = new Uri(googleU,"///test.htm"); // fails - Invalid URI: The hostname could not be parsed.
UPDATE:
var thirdRelativeUri = new Uri("///test.htm",UriKind.Relative); // works as expected
var newUri = new Uri(googleU,thirdRelativeUri); //Fails, same error even though it's a relative URI
それが失敗した:
@dariomは理にかなっている.NETでの取り扱いプロトコル相対URLは、しかし、これはまだ私にはバグのようですので、これがあることを指摘しました2番目のウリがあってもRelative
なぜ "///test.htm"ではなく "//test.htm"を渡すのですか? –
@DavidePiras原因私は悪いですか?私は以下の要求をする必要があります:http://example.com///test.htm完璧な世界でexample.com/test.htmとexample.com///test.htmは違いはありませんが実際残念ながら、Webサーバーとフレームワークは非常識で、数千ものものがあります。 –
私は@ dr.evilに同意します。構文解析では、無用なディレクトリ/パス区切り文字を受け入れる必要があります。 – leppie