How to formulate MapPageRoute with a hash (#) in it?

I use MapPageRouteto make a route to a page that works fine. However, I would like the page to scroll down to show the specific divwith id bottom. I tried to make the following route, but the hash is encoded in the URL so that the page does not scroll down.

RouteTable.Routes.MapPageRoute("Topics", 
 "onderwerpen/{ID}/{name}#bottom", 
 "~/TopicPage.aspx"
);

leads to:

mydomain/onderwerpen/1/title%23bottom

when called like this:

Response.RedirectToRoute("Topics", new { ID = 1, name = "title" });
+3
source share
2 answers

I think I found the most suitable solution. This answer is open for discussion.

string url = Page.GetRouteUrl("Topics", new { ID = 1, name = "title" });
Response.Redirect(url + "#bottom");
+1
source

Response.RedirectToRoute(). , , routeUrl #bottom. routeUrl, routeUrl - , . #bottom : physicalFile , , , -, URL.

ol 'Response.Redirect()?

Response.Redirect("onderwerpen/1/title#bottom");
0

All Articles