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?
这是不可能的:#之后的任何内容都不由浏览器发送,仅在加载的页面内部用于导航到锚点。
浏览器不会将该部分传输到服务器。您应该使用像这样的答案的Java脚本
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.