How to resolve url with non-ancestor references
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.mys开发者_Python百科ite.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#?
Uri uri = new Uri("http://www.mysite.com/home/../help/helppage.aspx");
uri.AbsoluteUri; // <- Contains http://www.mysite.com/help/helppage.aspx
精彩评论