LowercaseRoutesMVC with default lowercase route and ActionName attribute?

Nov 28, 2012 at 10:32 PM
Edited Nov 28, 2012 at 10:35 PM

I have the following catch-all route at the end of my route declarations:

routes.MapRouteLowercase(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

Outside of changing it to MapRouteLowercase instead of MapRoute, it's pretty standard.

Here's the problem I'm having: Using LowercaseRoutesMVC for this default route seems to break the built-in MVC functionality where you can add a custom action name to an action using an ActionNameAttribute:

[ActionName("My-Action")]
public ActionResult MyAction()
{
    return View("SomeView");
}

I've tried a few variations for the ActionName (e.g., "my-action", "My-Action"), and none of them seem to work. When I browse to /controller/my-action or /Controller/My-Action, I get an error message. ("The resource cannot be found.") The custom action name works as soon as I change the default route to MapRoute instead of MapRouteLowercase, but then I lose the lowercase functionality.

Is there any way to use custom action names with LowercaseRoutesMVC?