Getting error "Child actions are not allowed to perform redirect actions" in MVC

I am using ASP.NET MVC and trying to use HTML.RenderAction to render partial View, inside Main View, but getting error as "Child actions are not allowed to perform redirect actions."

Here is my .cshtml code 

<div class="col-lg-3">
        @{Html.RenderAction("GetLeftMenu", new { category = Model.Category });}
    <div class="col-lg-9">

and Here is my C# controller code

        public ActionResult GetLeftMenu(string category)
            using (var context = new ModelEntities())
                  var  List = context.Tuts.Where(a => a.Category == category && a.IsActive == true).Select(a=> new TutorialLeftMenu { Title= a.TutorialTitle, Id= a.Id, URL=a.TutorialURL, Order=Convert.ToInt32(a.TutOrder),MainHeader=a.MainHeader, Category=a.Category }).OrderBy(a=>a.Order).ToList();
                  return PartialView(List);

how can I resolve this error?

Asked by:- neena
: 993 At:- 11/24/2018 7:12:31 AM
ASP.NET C# mvc

1 Answers
profileImage Answered by:- Vinnu

You can send PartialView like this, as this is not allowed because MVC has already started Rendering the View to the browser (client). So the MVC Frameworks blocks this, because the client already receives data (html). As long as the rendering is in progress you not able to redirect in your child view.


  • the action corresponding to the URL has been processed and a view result has been returned.
  • ASP.NET MVC's view engine has started rendering the view, possibly sending headers and part of the HTML to the browser.
  • the view engine has come across a RenderAction() call and has started executing the action.
  • the action has tried to return a Redirect HTTP status code to the browser

You can return RedirectToAction instead (if needed)

At:- 11/26/2018 3:08:01 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly