1

I use routing in my web forms. for example:

routes.MapPageRoute("Home", "HomePage", "~/Default.aspx");

and I redirect to page with

Response.RedirectToRoute("Home");

now Is there a function (or solution) in asp.net that will give it route name [Home] (or URL parameters [HomePage]) and return original address (Default.aspx)?

Thanks a lot.

Morteza Karimi
  • 107
  • 1
  • 18

1 Answers1

0

You could just get the full URL:

HttpContext.Current.Request.Url.AbsoluteUri;

and see other .Url properties

see this answer for more examples: How to get the URL of the current page in C#

Community
  • 1
  • 1
Mark Redman
  • 24,079
  • 20
  • 92
  • 147
  • Thanks for answer. Other questions, however, similar to the previous question: Is there a function that will give it URL parameters (HomePage) and return route name? Thank you. – Morteza Karimi Jul 06 '15 at 07:25
  • Ok. I find my answer in http://stackoverflow.com/questions/721392/asp-net-system-web-routing-find-actual-aspx-page my answer is Page.AppRelativeVirtualPath; – Morteza Karimi Jul 07 '15 at 07:03