asp.net 4 url routing, how to access the route?
I'm using ASP.Net 4 URL routing on a web forms site.
I have multiple routes to a single page
routes.MapPageRoute("","开发者_如何学Cour-services", "~/Information.aspx");
routes.MapPageRoute("","our-company", "~/Information.aspx");
On the destination page (Information.aspx) how can I tell which route was used to get there, for example was it from our-services or our-company?
You can try with
HttpRequest.RawUrl
it should contain the original URL that was called (i.e. before the rewriting)
From the information page, you could check who referred to it via Request.UrlReferrer.
HTH.
精彩评论