Reputation: 1887
I want to get the absolute url of .net application with bookmark.
So if the request is coming from - www.mysite.com/myapplication/Home/Index#about
then how to get the above url in .net application?
I tried HttpContext.Request.Url.AbsoluteUri
but it is returning - www.mysite.com/myapplication/Home/Index
but how to get bookmark ("#about")
part of url?
Upvotes: 0
Views: 1676
Reputation: 1967
Try this,
assuming that the variable url holds your actual url
string[] bookmark = url.Split('#');
and the bookmark[1] will hold the Value of your bookmark, also.
string bookmark = url.Replace(HttpContext.Request.Url.AbsoluteUri(url), string.Empty);
Upvotes: 0
Reputation: 2497
The browser doesn't transmit that part to server.you should use java Script like this answer
Upvotes: 0
Reputation: 14535
It is not possible: anything after the # is not sent by the browser, it is only used inside the loaded page for navigating to anchors.
Upvotes: 1