SaaS CMS has officially launched! Learn more now.

Unknown Action Handlers using a case sensitive lookup on ActionName

Vote:
 

So I discovered today UnknownActionHandlers are used to handled things like XForms posts and presumably other specific non declared actions on controllers which looks rather neat.

However I set all my routes to be lowercase:

protected override void RegisterRoutes(RouteCollection routes)
{
    base.RegisterRoutes(routes);
    routes.LowercaseUrls = true;
}

This breaks things.

I realised that EPiServer.Web.Mvc.ActionControllerBase.HandleUnknownActions is doing a case senstive check on the unknown actions. Since actions are not normally handled case sensitively this seems like a bit of a bug.

I fixed it by overriding it in my page controller in this instance but not sure if anything else may be affected.

protected override void HandleUnknownAction(string actionName)
{
    foreach (var grouping in UnknownActionHandlers)
    {
        if (!string.Equals(grouping.Key, actionName, StringComparison.CurrentCultureIgnoreCase))
            continue;
 
        foreach (var unknownActionHandler in grouping)
        {
            var actionResult = unknownActionHandler.HandleAction(this);
            if (actionResult == null)
                continue;
            actionResult.ExecuteResult(ControllerContext);
            return;
        }
    }
    base.HandleUnknownAction(actionName);
}
#176922
Edited, Mar 29, 2017 20:15
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.