actionfilters

[asp.net mvc] Using a filter to execute a different action?

I want to avoid having lots of if Request.IsAjaxRequest() in my controllers. I was thinking that if I could condense this logic to an ActionFilter it would be easy to adopt a convention in my application to provide a second action for any request that may use Ajax, while providing a fall back if JavaScript is disabled. public ActionRes...

Why does this ActionFilterAttribute not import data to the ViewModel?

I have the following attribute public class ImportStatusAttribute : ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { var model = (IHasStatus)filterContext.Controller.ViewData.Model; model.Status = (StatusMessageViewModel)filterContext.Controller.TempData["status...