Write a custom action filter , override OnActionExecuting() and apply the filter to all your controllers. (Or just override OnActionExecuting() in your base controller, if you have a base controller at all.) The action method will look something like this:
protected override void OnActionExecuting(ActionExecutingContext filterContext) { var parameters = filterContext.ActionParameters; object shop; if (parameters.TryGetValue("shop", out shop)) { parameters["shop"] = ((string)shop).Replace("-", " ").ToLower(); } }
source share