Rea*_*n21 5 asp.net url routing routes
我在.Net Web应用程序中使用URL路由.我想阻止用户访问.aspx页面.
例:
实际网址 - http://www.mysite.com/Testimonials.aspx
路由URL - http://www.mysite.com/Testimonials
我希望用户只能通过访问来访问该页面/Testimonials,但我想设置/Testimonials.aspx为重定向到其路由/Testimonials.
是否有一种简单的方法可以在整个应用程序中为路由页面执行此操作?
您可以通过检查加载事件中的 URL 来处理重定向。检查此http://msdn.microsoft.com/en-us/library/cc668201.aspx#adding_routes_to_a_web_forms_application以将 /Testimonials 路由到您想要的页面。