title: Redirection to original URL having hash tag (#) broken in MVC4
body: <p>I am developing an SPA application using AngularJS working with REST Web API, on top of a very small layer of ASP.NET MVC4. For reasons not important here, I am not using the default Account Controller of MVC4.</p>
  
  <p>basically, I want to share "tasks" between users. My goal is to be able send the URL of a specific "task" entity to any user, via email. Clicking on that URL should launch the authentication. Following a successful authentication, I want to display the real task page info.</p>
  
  <p>AngularJS causes my URLs to have # sign, or a URL of a page displaying the task "XYZ123" is:
  <a href="http://hostname.com/#/tasks/XYZ123">http://hostname.com/#/tasks/XYZ123</a></p>
  
  <p>ASP.NET redirects the unauthorized access to that URL to:
  <a href="http://hostname.com/Home/Login?ReturnUrl=%2f#/tasks/XYZ123">http://hostname.com/Home/Login?ReturnUrl=%2f#/tasks/XYZ123</a></p>
  
  <p>This is OK, but the relevant controller method "cuts out" the path from #, so in:</p>
  
  <pre><code> public ActionResult Login(string returnUrl)
  </code></pre>
  
  <p>the value of 'returnUrl' will be just "/"</p>
  
  <p>So, I am losing the path: I would like to build a "Connect with Facebook" link having the original URL, like:</p>
  
  <p><a href="http://hostname.com/Login/ExternalLogin?ReturnUrl=%2F#/tasks/XYZ123">http://hostname.com/Login/ExternalLogin?ReturnUrl=%2F#/tasks/XYZ123</a></p>
  
  <p>but I cannot.</p>
  
  <p>What is the right way to solve this issue?</p>
  
  <p>I can think of creating my own redirection service URL without # tag, but this solution implies additional work, and covers only a case when the system is sending a message with task URL - humans will still try to copy/paste the location URL from the browser.</p>
  
  <p>Thanks for any hint.</p>
  
  <p>Max</p>