Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC 3 + Razor Error: Child actions are not allowed to perform redirect actions
    primarykey
    data
    text
    <p>So I saw <a href="https://stackoverflow.com/q/3573554/186643">this question</a> here on SO, but it hasn't really solved this problem for me.</p> <p>I have an ASP.NET MVC 3 + Razor app running on IIS5 on my dev pc, and then IIS6 for my dev web server. Everything worked great until I deployed it. I am bin deploying everything, with no problems on that front (that I can tell).</p> <p>Now I am getting this <strong>Child actions are not allowed to perform redirect actions</strong> error on my page. I am not sure how to pinpoint where it is failing.</p> <p>I'm using @Html.Action to pull in some drop down boxes with data:</p> <pre><code> public ActionResult Hierarchy() { List&lt;Store&gt; storeList = DBService.getStores(); if (DBService.Error != null) return RedirectToError(DBService.Error); List&lt;Department&gt; deptList = DBService.getDepts(); if (DBService.Error != null) return RedirectToError(DBService.Error); VM_Hierarchy hierarchy = new VM_Hierarchy(storeList, deptList); return View(hierarchy); } </code></pre> <p>If I remove the @Html.Action line, the page will render. It will then break if I do an AJAX request to a controller action such as this:</p> <pre><code> [HttpPost] public ActionResult InventoryList(string fromDate, string toDate) { List&lt;Inventory&gt; inventories = DBService.getInventories(fromDate, toDate); if (DBService.Error != null) return RedirectToAction("Error"); return View(inventories); } </code></pre> <p>If this isn't correct, how am I supposed to redirect to an error page or dictate what view gets returned on a post? Any help is appreciated. Thanks.</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.
    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