title: Asp.Net MVC2 RenderAction changes page mime type?
body: <p>It appears that calling <code>Html.RenderAction</code> in Asp.Net MVC2 apps can alter the mime type of the page if the child action's type is different than the parent action's.</p>
  
  <p>The code below (testing in MVC2 RTM), which seems sensible to me, will return a result of type <code>application/json</code> when calling <code>Home/Index</code>. Instead of dispylaying the page, the browser will barf and ask you if you want to download it.</p>
  
  <p>My question: Am I missing something? Is this a bug? If so, what's the best workaround?</p>
  
  <p>controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          ViewData[ "Message" ] = "Welcome to ASP.NET MVC!";
  
          return View();
      }
  
      [ChildActionOnly]
      public JsonResult States()
      {
          string[] states = new[] { "AK", "AL", "AR", "AZ", };
  
          return Json(states, JsonRequestBehavior.AllowGet);
      }
  }
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;h2&gt;&lt;%= Html.Encode(ViewData["Message"]) %&gt;&lt;/h2&gt;
  &lt;p&gt;
      To learn more about ASP.NET MVC visit &lt;a href="http://asp.net/mvc" title="ASP.NET MVC Website"&gt;http://asp.net/mvc&lt;/a&gt;.
  &lt;/p&gt;
  &lt;script&gt;
    var states = &lt;% Html.RenderAction("States"); %&gt;;
  &lt;/script&gt;
  </code></pre>