title: Form Authentication and URL Rewriting
body: <p>I'm trying to apply <strong><a href="http://www.codeproject.com/Articles/408306/Understanding-and-Implementing-ASP-NET-Custom-Form" rel="nofollow noreferrer">Custom Forms Authentication</a></strong> to my website to which I already applied Url Rewriting.
  using this code in <code>Application_Start</code> in <code>global.asax</code> file.</p>
  
  <pre><code>routes.MapPageRoute("bill-details",                 //Route Name
                      "{billno}",                     //URL with Parameters
                      "~/CallCenter/BillDetails.aspx" //Webforms page to Handle it.
                      );
  </code></pre>
  
  <p>But when I'm trying rewrite the Loginpage Url, I'm not able to rewrite it.</p>
  
  <pre><code>&lt;forms loginUrl="/Login.aspx" name="MyCustomAuthentication" timeout="30"/&gt;
  </code></pre>
  
  <p>The Actual Problem is, when I open a page it checks for Authentication and if it is not Authenticated, then it redirects to Login.aspx page.</p>
  
  <p>it shows as <code>mywebsite.com/Login.aspx?ReturnUrl="..."</code>
  I'm not able to rewrite this. If I cannot Remove the Return URL then Can I place <code>Login</code> Instead of <code>Login.aspx</code>??</p>
  
  <p>and If I use this Code from this post -> <a href="https://stackoverflow.com/questions/3716153/how-to-remove-returnurl-from-url/9796693#9796693">How to remove returnurl from url?</a></p>
  
  <p>If I use this, then the control loops over and over and it says - Too many Redirects. I think the problem is, when the Control goes to <code>Login</code> Page like <code>mywebsite.com/Login</code>, then It checks for authentication and It redirects to <code>Login.aspx</code> page. and your code redirects again to Login page . This loop continues.</p>
  
  <p>I also do not require the Return Url because I Users have to login first Inorder to access my website. </p>
  
  <p>So Can you help me in Removing the Return Url also?? And also in URL Rewriting ??</p>
  
  <p>I'm not able to solve this!!</p>
  
  <p>Check my website. -> <a href="http://orders.maabookings.com" rel="nofollow noreferrer">http://orders.maabookings.com</a>
   <code>UserId - temp Password - temp</code></p>
  
  <p>In this In the Login page, Its displaying as 
  <code>http://orders.maabookings.com/Login.aspx?ReturnUrl=%2f</code>
  I need this to be <code>http://orders.maabookings.com/Login</code>
  How can I do this??</p>