Situation is this:
I can\'t find a way of getting the viewModel
that was passed to the POST action method.
[HttpPost]
public ActionResul
You could create a custom model binder that inherits from DefaultModelBinder and assign the model to TempData
:
public class MyCustomerBinder : DefaultModelBinder
{
protected override void OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
base.OnModelUpdated(controllerContext, bindingContext);
controllerContext.Controller.TempData["model"] = bindingContext.Model;
}
}
and register it in Global.asax
:
ModelBinders.Binders.DefaultBinder = new MyCustomerBinder();
then access it:
protected override void OnException(ExceptionContext filterContext)
{
var model = filterContext.Controller.TempData["model"];
...
}