C# – Get url parts without host

asp.netc

I have a url like this :

http://www.somesite.com/mypage.aspx?myvalue1=hello&myvalue2=goodbye.

I want to get mypage.aspx?myvalue1=hello&myvalue2=goodbye from it . Can you tell me how can I get it ?

Best Answer

Like this:

new Uri(someString).PathAndQuery