3

I have urls with references to folders that are not direct ancestors of the page pointed to - like these below:

    http://www.mysite.com/home/../help/helppage.aspx

    http://www.mysite.com/contact/../help/helppage.aspx

    http://www.mysite.com/accounts/performing-accounts/../../help/helppage.aspx

I'd like to be able to unambiguously resolve these to

http://www.mysite.com/help/helppage.aspx.

How do I do this in C#?

Tola Odejayi
  • 3,019
  • 9
  • 31
  • 46
  • Please see this one : http://stackoverflow.com/questions/128990/absolute-url-from-base-relative-url-in-c – Gant Feb 07 '10 at 02:03

1 Answers1

1
Uri uri = new Uri("http://www.mysite.com/home/../help/helppage.aspx");
uri.AbsoluteUri; // <- Contains http://www.mysite.com/help/helppage.aspx
Cory Charlton
  • 8,868
  • 4
  • 48
  • 68