Retrieving Anchor Link In URL for ASP.Net

前端 未结 3 1718
滥情空心
滥情空心 2020-11-27 22:28

I have an url like so:

http://localhost/place/663828/bangkok-paradise-restaurant-toronto#r306040

I am trying to see if theres the existence of the anchor tag

3条回答
  •  被撕碎了的回忆
    2020-11-27 22:49

    A fragment can be parsed from a url in C# in the following way:

    var uri = new Uri("http://localhost?id=2#token=23");
    var fragment = uri.Fragment; // will return #token=23
    

    There is a problem however in that the browser won't send fragments to the server. If you receive requests from a service that includes this info in the request, it will available from the server side too.

提交回复
热议问题