Normalizing URI to make it work correctly with MakeRelativeUri

Posted by dr. evil on Stack Overflow See other posts from Stack Overflow or by dr. evil
Published on 2009-12-09T15:25:08Z Indexed on 2010/06/09 5:02 UTC
Read the original article Hit count: 382

Filed under:
|
|
|
Dim x AS New URI("http://www.example.com/test//test.asp")
Dim rel AS New URI("http://www.example.com/xxx/xxx.asp")
Console.Writeline(x.MakeRelativeUri(rel).Tostring())

In here output is:

../../xxx/xxx.asp

Which looks correct almost all web servers will process the two of the following as same request:

http://www.example.com/test//test.asp
http://www.example.com/test/test.asp

What's the best way to fix this behaviour is there any API to do this, or shall manually create a new URI and remove all // in the path?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET