You can use custom route handler to give you needed functionality:
public class HyphenatedRouteHandler : MvcRouteHandler
{
protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
{
requestContext.RouteData.Values["controller"] = requestContext.RouteData.Values["controller"].ToString().Replace("-", "_");
requestContext.RouteData.Values["action"] = requestContext.RouteData.Values["action"].ToString().Replace("-", "_");
return base.GetHttpHandler(requestContext);
}
}
And the route should be registered using that handler:
var route = routes.MapRoute(
"Some Action",
"{controller}/{action}/{id}"
);
route.RouteHandler = new HyphenatedRouteHandler();
There is a similar quastion asked here: ASP.net MVC support for URL's with hyphens