How to fix Child actions are not allowed to perform redirect actions, other answers does not fix

天涯浪子 提交于 2019-12-03 05:10:46
OakNinja

Instead of Calling public ActionResult CheckoutCompleteOK() on post, remove that action and Create a HTTP Post Action for public ActionResult PaymentByBankTransfer().

Then return RedirectToAction("Complete"); in PaymentByBankTransfer post method.

I think this would solve your problem.

Without using javascript for redirect: If you put forms inside your child view,Sometimes if you specify action name and controller name in Beginform helper(inside child view), this problem doesn't happen. for example I changed my child action view like this :

Before :

@using (Html.BeginForm())
{
 ...
}

After :

    @using (Html.BeginForm("InsertComment", "Comments", FormMethod.Post, new { id = "commentform" })) 
{
 ...
}

Now, You can put RedirectAction command inside "InsertComment" action and everything will work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!