Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Normal Request to .ASPX pages When Implemeting URL Routing

I am using URL Routing in my .Net Web Application. I would like to prevent users from being able to access the .aspx page.

Example:

Actual URL - http://www.mysite.com/Testimonials.aspx

Routed URL - http://www.mysite.com/Testimonials

I want users to be able to access the page only by going to /Testimonials, but I would like to setup /Testimonials.aspx to redirect to its route at /Testimonials.

Is there an easy way to do this for Routed Pages throughout the application?

like image 336
Reaction21 Avatar asked Nov 06 '22 06:11

Reaction21


1 Answers

You can handle the redirect by checking the URL in the Load Event. Check this http://msdn.microsoft.com/en-us/library/cc668201.aspx#adding_routes_to_a_web_forms_application for routing the /Testimonials to the page you want.

like image 159
NoAlias Avatar answered Nov 09 '22 15:11

NoAlias