ASP.net MVC support for URL's with hyphens
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-01-15T10:45:40Z
Indexed on
2010/03/12
8:17 UTC
Read the original article
Hit count: 198
Is there an easy way to get the MvcRouteHandler to convert all hyphens in the action and controller sections of an incoming URL to underscores as hyphens are not supported in method or class names.
This would be so that I could support such structures as sample.com/test-page/edit-details mapping to Action edit_details and Controller test_pagecontroller while continuing to use MapRoute method.
I understand I can specify an action name attribute and support hyphens in controller names which out manually adding routes to achieve this however I am looking for an automated way so save errors when adding new controllers and actions.
© Stack Overflow or respective owner