How to allow a URL with links to non-ancestors

I have URLs with links to folders that are not the direct ancestors of the page that is pointed to - as shown 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 would like to be able to explicitly authorize them for

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

How to do it in C #?

+3
source share
1 answer
Uri uri = new Uri("http://www.mysite.com/home/../help/helppage.aspx");
uri.AbsoluteUri; // <- Contains http://www.mysite.com/help/helppage.aspx
+1
source

Source: https://habr.com/ru/post/1731734/


All Articles