Get url parts without host

后端 未结 4 2011
遥遥无期
遥遥无期 2020-12-10 10:14

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=goodb

4条回答
  •  不思量自难忘°
    2020-12-10 11:06

    Place your string URL into a URI object and then use the AbsolutePath & Query properties to get the URL parts you need.

    Or use the PathAndQuery property to get both, which is what you need.

    More information can be found here:

    http://msdn.microsoft.com/en-us/library/system.uri_members%28v=VS.71%29.aspx

提交回复
热议问题