title: How to login using ASP.NET MVC4?
body: <p>Here are some bits of code from my attempt. It does not work; after "logging in", the user isn't redirected to the home/index page, but the login page just reloads.</p>
  
  <p>Web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="~/Account/Login" /&gt;
  &lt;/authentication&gt;
  
  ...
  
  &lt;defaultDocument&gt;
    &lt;files&gt;
      &lt;add value="~/Account/Login"/&gt;
    &lt;/files&gt;
  &lt;/defaultDocument&gt;
  </code></pre>
  
  <p>Controllers/AccountController.cs:</p>
  
  <pre><code>public class AccountController : Controller
  {
      //
      // GET: /Account/Login
      public ActionResult Login()
      {
          return View();
      }
  }
  </code></pre>
  
  <p>Views/Account/Login.aspx:</p>
  
  <pre><code>&lt;asp:Login ID="login" runat="server" DestinationPageUrl="~/Views/Home/Index.aspx"&gt;
      ...
  &lt;/asp:Login&gt;
  </code></pre>