I want to set the value of Thread.CurrentCulture
based on some route data, but I can\'t find an event to hook to that fires after the routes are calculated and befo
You could write a custom action filter attribute:
public class CustomFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// This method is executed before calling the action
// and here you have access to the route data:
var foo = filterContext.RouteData.Values["foo"];
// TODO: use the foo route value to perform some action
base.OnActionExecuting(filterContext);
}
}
And then you could decorate your base controller with this custom attribute. And here's a blog post illustrating a sample implementation of such filter.