I have set up 10+ MapPageRoutes , which works fine. Now I need to generate urls for menus. Method Page.GetRouteUrl seems not applicable, because I dont want to setup every link manually.
Is there any solution for get route url by physical file?
For example If I have MapPageRoute
routes.MapPageRoute("RouteOne", "Users", "~/UsersList.aspx");
and I need somehow get "Users" by "~/UsersList.aspx".
Use query string
for dynamic menu pages and then use URL Rewrite Rule
for that query string so it will look like below.. according to below you will get different url for all dynamic menu pages
Original
http://www.yoururl.com/page?id=1
http://www.yoururl.com/page?id=2
After URL rewrite
http://www.yoururl.com/page/1
http://www.yoururl.com/page/2
for more reference URL Rewrite - http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
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.