I trying to return a ViewResult in OnActionExecuted method override from ActionFilterAttribute class.Like below:
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
if (CreateCookie && filterContext.Exception == null)
{
LoginCookies lcookie = new LoginCookies(usuDs, usuSenha);
lcookie.WriteCookie("SCE", 10);
}
else
{
filterContext.Result = new ViewResult() { ViewName = "Login" };
filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
}
It works fine to return to a view called "Login",but i need to pass the model object to this view (in this case model object is type of Users) and i dont know how to pass it using ViewResult class directly.
Any ideias?
UPDATED: Ive solved my problem setting filteContext.ExceptionHandled to TRUE,but the main problem was not solved,i cant set MODEL property of View,it is always null.