title: Forms Authentication - Redirect Back to Original Domain
body: <p>Example:</p>
  
  <p>Application = <a href="https://test2.mytest.com/MyApplication/Download.aspx" rel="nofollow">https://test2.mytest.com/MyApplication/Download.aspx</a> </p>
  
  <p>The application has forms authentication enabled in the web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="https://test.mytest.com/Login/" name=".ASPXAUTH"/&gt;
  &lt;/authentication&gt;
  &lt;authorization&gt;
    &lt;deny users="?"/&gt;
  &lt;/authorization&gt;
  </code></pre>
  
  <p>When accessing the application it correctly redirect to the login page:<br>
  <a href="https://test.mytest.com/Login/?ReturnUrl=%2fMyApplication%2fDownload.aspx" rel="nofollow">https://test.mytest.com/Login/?ReturnUrl=%2fMyApplication%2fDownload.aspx</a></p>
  
  <p>However, after successfully logging in it goes to:<br>
  <a href="https://test.mytest.com/MyApplication/Download.aspx" rel="nofollow">https://test.mytest.com/MyApplication/Download.aspx</a><br>
  instead of<br>
  <a href="https://test2.mytest.com/MyApplication/Download.aspx" rel="nofollow">https://test2.mytest.com/MyApplication/Download.aspx</a>  </p>
  
  <p>It is using the sub-domain of where the login application is (test.mytest.com), not the sub-domain of the original request (test2.mytest.com). 
  Is there anyway to have forms authentication redirect back to the original requesting sub-domain instead of the sub-domain that the login app is on?  </p>
  
  <p>Any help on this would be greatly appreciated.</p>