Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net MVC : Execution of the child request failed. Please examine the InnerException for more information

I'm recieving the following error message,

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

However this action DOES exist and the controller does exist (As it work everywhere on the site) I looked at the inner exception.

Execution of the child request failed. Please examine the InnerException for more information.

(This is the inner exception...)

Stack Trace

at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)

Now, we have a website set-up with a dynamic menu system so we are using RenderAction() on a generic controller to build this menu system up.

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

This call is made from the MasterPage and it works fine until there was a validation error like so,

 [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 fine when there this is a new user, but if someone enters an email that already exist we get the above error. THis RenderAction Method works all over the site (This is the first form we have added)

Any suggestions?

like image 311
LiamB Avatar asked Jul 09 '10 10:07

LiamB


1 Answers

Fixed:

The RenderAction() Method is below

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

Removing the HttpGet Attribute has resolved the issue.

        public ActionResult RenderMenu()
        {
            //Do Stuff
        }

Would love to know why?

like image 93
LiamB Avatar answered Sep 19 '22 18:09

LiamB