0

I have enabled friendly URLs in my application by having the following line:

routes.EnableFriendlyUrls();

in my App_Start/RouteConfig.cs file.

I would like to get the Friendly URL of the currently executing page. I know that I can always the currently executing file page from the request and take off the ".aspx" extension from that.

this.Request.CurrentExecutionFilePath;

However, I have a feeling that the Friendly URL framework component should be able to directly provide me the information I am looking for rather than me having to do string manipulation.

Any pointers on the same will be appreciated. Thanks for looking up my question.

Moiz Tankiwala
  • 6,070
  • 7
  • 38
  • 51

1 Answers1

0

What are you trying to achieve exactly?

If you're trying to extract a value from the url like you would normally do with Request.QueryString["someValue"], you should read up on how Routing works. Here's a good write-up http://www.codeproject.com/Tips/698666/USE-OF-MapPageRoute-Method-IN-ASP-NET-WEBFORM-ROUT

If you are only interested in getting the url itself, you can use

Page.Request.RawUrl

Cheers

Scotty
  • 1,127
  • 1
  • 7
  • 17
  • I would like to know the currently executing page's friendly URL. If I tap into the Request URL, and if I have come to the current page's code via a server transfer, I get the original page's URL. – Moiz Tankiwala Sep 13 '14 at 11:10