KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I asked a question earlier today about ActionFilters in ASP.Net MVC. It turned out my problem was really that my ActionFilter is not even running. Among other things I read this article , and I can't find anything he does that I don't. This is my code: // The ActionFilter itself public class TestingIfItWorksAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { filterContext.Controller.TempData["filter"] = "it worked!"; base.OnActionExecuting(filterContext); } } // The Controller Action with the filter applied [TestingIfItWorks] public ActionResult Test() { var didit = TempData["filter"]; return View(); } A breakpoint in the filter method is never hit when I debug, and TempData["filter"] holds a null value when the view is rendered. Why is this not working?
Tags (comma-separated)
Save Edits
Cancel