开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜