Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.net mvc - Accessing view Model from a custom Action filter

I am trying to access the Model data passed to the view in the action filter OnActionExecuted. Does anyone know if this is possible?

I am trying to do something like this:

public override void OnActionExecuted(ActionExecutedContext filterContext) {     //get model data     //...      sitemap.SetCurrentNode(model.Name); } 

Any advice?

like image 357
ebrown Avatar asked May 16 '09 16:05

ebrown


1 Answers

The model is at:

filterContext.Controller.ViewData.Model 
like image 165
Steven Lyons Avatar answered Sep 18 '22 16:09

Steven Lyons