title: MVC4 Razor Multiple strongly type partial view with action in one page
body: <p>I have a requirement where I have Login and Register form in Homepage. I believe this quite a common scenario however I am having difficulty achieving this. </p>
  
  <p>This Login and Register forms are two separate Strongly Type Partial View which is being used in Index view </p>
  
  <p>Below is the controller for Register. I will skip the login since if I get this to work, the other should be similar.</p>
  
  <p><strong>Register Controller</strong></p>
  
  <pre><code>    //
      // GET: /Account/Register
  
      [AllowAnonymous]
      public ActionResult Register()
      {
          return PartialView();
      }
  
      //
      // POST: /Account/Register
  
      [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public ActionResult Register(RegisterModel registerModel)
      {
          if (ModelState.IsValid)
          {
              // Attempt to register the user
              try
              {
                  _webSecurity.CreateUserAndAccount(registerModel.Email, registerModel.Password,
                                                   new { registerModel.FirstName, registerModel.LastName, registerModel.Email });
                  _webSecurity.Login(registerModel.Email, registerModel.Password);
  
                  return RedirectToAction("Manage", "Account");
              }
              catch (MembershipCreateUserException e)
              {
                  ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
              }
          }
  
          // If we got this far, something failed, redisplay form
          return View(registerModel);
      }
  </code></pre>
  
  <p><strong>Index Controller</strong></p>
  
  <pre><code>    //
      // GET: /Home/
  
      public ActionResult Index()
      {
          //
          // If logedin redirect to profile page
          // Else show home page view
          //
  
          ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
          if (Request.IsAuthenticated)
          {
              return RedirectToAction("Manage", "Account", new { id = HttpContext.User.Identity.Name });
          }
          return View();
      }
  </code></pre>
  
  <p><strong>Register View</strong></p>
  
  <pre><code>@using System.Web.Optimization
  @model BoilKu.Web.ViewModels.RegisterModel
  
  @using (Html.BeginForm("Register","Account", FormMethod.Post)) {
  @Html.AntiForgeryToken()
  @Html.ValidationSummary()
  
  &lt;fieldset&gt;
      &lt;legend&gt;Registration Form&lt;/legend&gt;
      &lt;ol&gt;
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.FirstName)
              @Html.TextBoxFor(m =&gt; m.FirstName)
          &lt;/li&gt;
             ...
             ... Omitted codes
             ...
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.Password)
              @Html.PasswordFor(m =&gt; m.Password)
          &lt;/li&gt;
      &lt;/ol&gt;
      &lt;input type="submit" value="Register" /&gt;
  &lt;/fieldset&gt;
  }
  
  @section Scripts {
  @Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>
  
  <p><strong>Index View</strong></p>
  
  <pre><code>@model BoilKu.Web.ViewModels.HomeModel
  @{
      ViewBag.Title = "Home Page";
  }
  @{
      Html.RenderAction("Login", "Account");
  }
  @{
      Html.RenderAction("Register", "Account");
  }
  </code></pre>
  
  <p>Now with the above code, I have managed to get the partial view to display on the homepage. However when I click "Register" after filling up the details it will automatically redirect to my Register page with the fields pre populated. This is not what I want. I expect the register to happened on the homepage and redirect to Profile page when it has successfully registered. How do I go about doing this? Thank you for reading and apology for the noobishe questions. I am still quite new to MVC. </p>
  
  <p><strong>Update</strong>
  Changing the Register Controller return from PartialView() to View() will act according the above requirement. However it will embed the page into a page. (i.e. the top navigation will be duplicated. )
  Anyone?</p>