1

当我 sumit 一个表单时,我想重定向到另一个带有 viewresult 类的页面。这是我的过滤器代码:

 [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)

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

这仅适用于 actionresutland partialviewresult GET方法。但我想用于actionresutland Post Method 。因为我提交了一个表单方法并且我得到以下错误

'~/Error/Index' 或其主人未找到或没有视图引擎支持搜索的位置。已搜索以下位置:\r\n~/Error/Index"

4

0 回答 0