Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fix Child actions are not allowed to perform redirect actions, other answers does not fix
    primarykey
    data
    text
    <p>ASP.NET MVC2 view:</p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;MvcMusicStore.ViewModels.PaymentViewModel&gt;" %&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt; ... &lt;form action="&lt;%= Html.Action("PaymentByBankTransfer", "Checkout") %&gt;" &gt; &lt;input type="submit" value="Payment by bank transfer" /&gt; &lt;/form&gt; </code></pre> <p>CheckoutController:</p> <pre><code> public ActionResult PaymentByBankTransfer() { var order = Session["Order"] as Order; ExecCommand(@"update dok set confirmed=true where order={0}", order.OrderId); return CheckoutCompleteOK(); var cart = ShoppingCart.GetCart(HttpContext); cart.EmptyCart(); // https://stackoverflow.com/questions/1538523/how-to-get-an-asp-net-mvc-ajax-response-to-redirect-to-new-page-instead-of-inser?lq=1 return JavaScript("window.location = '/Checkout/CompleteOK'"); } // common method called from other controller methods also public ActionResult CheckoutCompleteOK() { var cart = ShoppingCart.GetCart(HttpContext); cart.EmptyCart(); // prevent duplicate submit if user presses F5 return RedirectToAction("Complete"); } public ActionResult Complete() { var order = Session["Order"] as Order; SendConfirmation(order); return View("PaymentComplete", order); } </code></pre> <p>pressing form submit button causes exception</p> <pre><code>Child actions are not allowed to perform redirect actions </code></pre> <p>As code shows most upvoted answer from </p> <p><a href="https://stackoverflow.com/questions/1538523/how-to-get-an-asp-net-mvc-ajax-response-to-redirect-to-new-page-instead-of-inser?lq=1">How to get an ASP.NET MVC Ajax response to redirect to new page instead of inserting view into UpdateTargetId?</a></p> <p>is tried to fix it, but this causes other error: browser tries to open url <code>window.location = '/Checkout/CompleteOK'</code></p> <p>How to fix this exception? Everything looks OK, there is no partial views as described in other answers. I tried als o to use method='post' attribute in form but problem persists.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload