title: C# ASP.Net MVC: RedirectFromLoginPage always goes to default url, and not to returnurl
body: <p>I have an MVC4 application with Membership logon (through FormsAuthentication).</p>
  
  <p>This is defined in web.config as follows.
  My default url is home root (~/):</p>
  
  <pre><code>&lt;roleManager enabled="true" /&gt;
  &lt;authentication mode="Forms"&gt;
    &lt;forms defaultUrl="~" loginUrl="~/Account" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>In my AccountController in the Login post method, following code is relevant.
  This code is executed when the user clicks on the login with valid credentials.</p>
  
  <pre><code>if (Membership.ValidateUser(creds.Username, creds.Password))
  {
      FormsAuthentication.RedirectFromLoginPage(creds.Username, false);
      return null;
  }
  </code></pre>
  
  <p>Now, if I'm navigating (anonymously) to: ~/Admin, I get redirected to ~/Account to log in, which is perfect. I can see that the url is formed as follows:</p>
  
  <pre><code>http://localhost:23759/Account?ReturnUrl=%2fAdmin
  </code></pre>
  
  <p>But, when I succesfully login, I get redirected to home (~/) instead of ~/Admin</p>
  
  <p>Please help! 
  Many thanks!</p>
  
  <p><strong>Edit: Found the actual issue: it was the post method that wasn't receiving the querystring</strong></p>