Asp.Net MVC: the child request has completed. Check out InnerException for more information.

I get the following error message,

The public action method 'RenderMenu' was not found on the 'Web.Controllers.SiteController' controller.

However, this action exists and the controller exists (since it works everywhere on the site) I looked at the internal exception.

Failed to execute child request. Examine InnerException for more information.

(This is an internal exception ...)

Stack trace

in System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap [TResult] (Func`1 func) in System.Web.HttpServerUtility.ExecuteInternal (IHttpHandler handler, TextWriter writer, Boolean preservePathPathPathPath Boolean, PhyserveForm, PhysiverPath, Boreleput, PhysiverForm, Physician , Exception error, String queryStringOverride)

Now we have a website with a dynamic menu system, so we use RenderAction () on the general controller to create this menu system.

<% Html.RenderAction("RenderMenu", "Site"); %> 

This call is made from MasterPage, and it works fine until there is such a validation error.

  [HttpPost] public ActionResult Register(UserModel UserToAdd) { if(!ModelState.IsValid) { return View(UserToAdd); } //Run some validation if (_UserService.DoesEmailExist(UserToAdd.EMail)) { TempData["error"] = "Email Address Already in use!"; return View(UserToAdd); } //Add the user TempData["info"] = "User Added - " + UserO.ID; return View("Success"); } 

It works great when it is a new user, but if someone enters an existing letter, we get the above error. This RenderAction method works throughout the site (this is the first form we added)

Any suggestions?

+6
validation asp.net-mvc-2
source share
2 answers

Fixed:

RenderAction () method below

  [HttpGet] public ActionResult RenderMenu() { //Do Stuff } 

Removing the HttpGet attribute resolved the issue.

  public ActionResult RenderMenu() { //Do Stuff } 

I would like to know why?

+8
source share

This is because your parent request is [HttpPost] and the child request works in the same verb as the parent. If your method is marked as [HttpGet] , it will not respond to requests [HttpPost] . Doing the action directly through your browser works because it is GET . Clicking on an action as a child action in the POST context will not work.

-one
source share

All Articles