title: ASP.Net MVC partial views keeping their model state?
body: <p>This is probably again a newbie question. </p>
  
  <p>When I create an ASP.NET MVC2 application, an Account Controller with an Action LogIn is created like this:</p>
  
  <pre><code>[HttpPost]
  public ActionResult LogOn(LogOnModel model, string returnUrl)
  {
     if (ModelState.IsValid)
     {
        if (MembershipService.ValidateUser(model.UserName, model.Password))
        {
           FormsService.SignIn(model.UserName, model.RememberMe);
           if (!String.IsNullOrEmpty(returnUrl))
           {
              return Redirect(returnUrl);
           }
           else
           {
             return RedirectToAction("Index", "Home");
           }
         }
         else
         {
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
         }
       }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  </code></pre>
  
  <p>Now, I don't want to have a login page, I want to have login controls as part of a bigger page. So, I changed Login.aspx to Login.ascx and I am integrating it in my main view either with Html.RenderPartial or Html.RenderAction. </p>
  
  <p>Both works like a charm if the login is successfull. If it is not, the </p>
  
  <pre><code>return View(model)
  </code></pre>
  
  <p>is killing me. 
  What I want is to go back to my main page (call it Home/Index) but with the error information of the partial view. </p>
  
  <pre><code>return RedirectToAction("Index", "Home")
  </code></pre>
  
  <p>Obviously doesn't work. </p>
  
  <p>Hints?</p>