tags:

views:

280

answers:

2

I need to combine two urls, but it seems that UriBuilder doesn't support url's with ../../ in them. Is my only option to code this by hand? I'm trying something like this :

Uri pageUri = new Uri("http://site.com/a/b/c.html");
string redirectUrl = "../../x.html";

UriBuilder builder = new UriBuilder(pageUri);
builder.Path += redirectUrl;

Thanks for any tips on how to do this the right way.

A: 

This is working fine for me. You tried to call builder.Uri.OriginalString to get the full address back?

Bobby
I used builder.ToString()
Morri
+1  A: 

You could also to use:

Uri redirect = new Uri(
    new Uri("http://site.com/a/b/c.html"), "../../x.html");
Rubens Farias