I'm using MapPageRoute
to make a route to a page, which works fine. However, I would like the page to scroll to the bottom to show a certain div
with id bottom
. I have tried to make the following route but the hash is being encoded in the URL so the page does not scroll down.
RouteTable.Routes.MapPageRoute("Topics",
"onderwerpen/{ID}/{name}#bottom",
"~/TopicPage.aspx"
);
results in:
mydomain/onderwerpen/1/title%23bottom
when called like this:
Response.RedirectToRoute("Topics", new { ID = 1, name = "title" });
I think I found the most suitable solution myself. This answer is open for discussion.
string url = Page.GetRouteUrl("Topics", new { ID = 1, name = "title" });
Response.Redirect(url + "#bottom");