The code:
public class TheFilter : ActionFilterAttribute { public override void OnActionExecuted(ActionExecutedContext filterContext) { var controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; } } public class NotesController : BaseController { [TheFilter] [HttpPost] public ActionResult Edit(EditViewModel viewModel) { viewModel.Note.Modified = DateTime.Now; viewModel.Note.ModifiedBy = User.Identity.Name; var noteTable = StorageHelper.GetTable<Note>(viewModel.PageMeta.DataSourceID); noteTable.AddOrUpdate(viewModel.Note); return Home(); } }
When I am debugging when returning Home () and having stepped over, I will bypass the action filter and go directly to the Home () method.
Am I declaring an action filter correctly?
source share