Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用非祖先引用解析url_C#_Url - Fatal编程技术网

C# 如何使用非祖先引用解析url

C# 如何使用非祖先引用解析url,c#,url,C#,Url,我的URL引用的文件夹不是指向页面的直接祖先-如下所示: 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 我希望能够毫不含糊地解决这些问题 我如何在C#中做到这一

我的URL引用的文件夹不是指向页面的直接祖先-如下所示:

    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
我希望能够毫不含糊地解决这些问题

我如何在C#中做到这一点?

Uri=newuri(“http://www.mysite.com/home/../help/helppage.aspx");
uri.AbsoluteUri;//请看这个:
Uri uri = new Uri("http://www.mysite.com/home/../help/helppage.aspx");
uri.AbsoluteUri; // <- Contains http://www.mysite.com/help/helppage.aspx