title: Redirecting after processing partial view with ajax results in next page loading inside the partial view's div.
body: <p>I have two partial views in a parent page. The problem is when I call redirect to local once the form has successfully been submitted the next page is loaded in the place of the partial view inside the parent. The other form is visable as well. Here's the action methods and view logic associated with one of them as they're almost identical. How do I fix this?</p>
  
  <pre><code>[AllowAnonymous]
      public ActionResult _LoginPartial(string returnUrl)
      {
          ViewBag.ReturnUrl = returnUrl;
          return PartialView(new LoginModel());
      }
  
      [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public ActionResult _LoginPartial(LoginModel model, string returnUrl)
      {
          if (ModelState.IsValid &amp;&amp; WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
          {
              return RedirectToLocal(returnUrl);
          }
  
          // If we got this far, something failed, redisplay form
          ModelState.AddModelError("", "The user name or password provided is incorrect.");
          return PartialView(model);
      }
  </code></pre>
  
  <p>The portion of the parent page that renders the partial </p>
  
  <pre><code>@{
  if(!WebSecurity.IsAuthenticated){
      &lt;h2&gt;Use a Creative Works account to log in.&lt;/h2&gt;
  @Html.Action("_LoginPartial", new {returnUrl = ViewBag.ReturnUrl })
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The partial view </p>
  
  <pre><code>@using (Ajax.BeginForm("_LoginPartial", new {returnUrl = ViewBag.ReturnUrl}, 
  new AjaxOptions(){UpdateTargetId = "loginForm", 
  InsertionMode = InsertionMode.Replace
  })) {        
  
   @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
  
      &lt;fieldset&gt;
          &lt;legend&gt;Log in Form&lt;/legend&gt;
          &lt;ol&gt;
              &lt;li&gt;
                  @Html.LabelFor(m =&gt; m.UserName)
                  @Html.TextBoxFor(m =&gt; m.UserName)
                  @Html.ValidationMessageFor(m =&gt; m.UserName)
              &lt;/li&gt;
              &lt;li&gt;
                  @Html.LabelFor(m =&gt; m.Password)
                  @Html.PasswordFor(m =&gt; m.Password)
                  @Html.ValidationMessageFor(m =&gt; m.Password)
              &lt;/li&gt;
              &lt;li&gt;
                  @Html.CheckBoxFor(m =&gt; m.RememberMe)
                  @Html.LabelFor(m =&gt; m.RememberMe, new { @class = "checkbox" })
              &lt;/li&gt;
          &lt;/ol&gt;
          &lt;input type="submit" value="Log in" /&gt;
      &lt;/fieldset&gt;
  
      }
  </code></pre>