ViewResult class result not work when i submit a form method post for redirect to another view

149 Views Asked by At

when i sumit a form i want redirect to another page with viewresult class. this is my filter code :

 [ValidateSpamFilter(duration: 60, isAddress: false, keepRequestinCache: true)]
    // HttpPost Method For Submit Form . you can add comment by this method .
    [System.Web.Mvc.HttpPost]
    public ActionResult AddComment(CommentAddDTO Comments)

and

 filterContext.Result = new ViewResult { ViewName = "~/Error/Index"  };

this just work for actionresutland partialviewresult GET methods. But i want uses for actionresutland Post Method . Because i submit a form method and i get below Error

'~/Error/Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:\r\n~/Error/Index"

0

There are 0 best solutions below