From every page of a website I'm making, you're able to sign in. On pages with other forms, I get the following error after submitting: "Child actions are not allowed to perform redirect actions." All forms worked fine until I added the Sign In. In addition, the Sign In works correctly when you use it. The error only appears if I submit a different form. I've set a breakpoint and I've watched what happens when I hit the other submit. For some reason, the SignIn Post ActionResult is trying to run. Any help would be appreciated.
Error:
Child actions are not allowed to perform redirect actions. Line 67: @{Html.RenderAction("SignIn", "Account");}
Sign In View
@using (Html.BeginForm("SignIn", "Account", FormMethod.Post))
{
<input class="signInSubmit" type="submit" name="submitButton" value="" />
}
Another Form in View
@using (Html.BeginForm("Confirm", "Cart", null, FormMethod.Post, new { @id = "productDetailsForm" }))
{
<input class="addToCart" type="submit" name="submit" value="" />
}
Sign In Controller
// GET: /Account/SignIn
public ActionResult SignIn()
{
return PartialView();
}
// POST: /Account/SignIn
[HttpPost]
public ActionResult SignIn(Customer customer)
{
try
{
//Stuff is here
return RedirectToAction("Index", "Home");
}
catch
{
return RedirectToAction("Registration");
}
}
Other form Controller
// GET: /Cart/
public ActionResult Index()
{
CartViewModel cart = getCart();
return View(cart);
}
//POST: Cart/Confirm
[HttpPost]
public ActionResult Confirm(int productID, bool certs, int quantity)
{
CartItemViewModel viewModel = new CartItemViewModel
{
Item = productRep.GetProductByID(productID),
Certs = certs,
Quantity = quantity
};
return View(viewModel);
}
HTML Source Code
<form action="/Account/SignIn" method="post">
<input class="signInSubmit" type="submit" value="" />
</form>
<form action="/Cart/Confirm" id="productDetailsForm" method="post">
<input class="addToCart" type="submit" value="" />
</form>