title: Forms Authentication & IIS7 (&MVC): Why ReturnUrl=/ is added?
body: <p>When trying to access my site: </p>
  
  <p>www.X.com</p>
  
  <p>The browser changes the url to:</p>
  
  <p>www.X.com/</p>
  
  <p>The problem is that the result url is:</p>
  
  <p>www.X.com/HomePage.aspx?ReturnUrl=/</p>
  
  <p>(HomePage.aspx is the default page)</p>
  
  <p>On IE: www.X.com/HomePage.aspx?ReturnUrl=%2f</p>
  
  <p>For some reason the Forms Authentication treats / as a page that the user is trying to access and then gets redirects to: HomePage.aspx?ReturnUrl=/</p>
  
  <p>How can I set the Forms Authentication (or the MVC routing) not to treat / as a page, so when accessing www.X.com it will not change the url?</p>
  
  <p>The site runs on windows server 2008 IIS7, .NET 4.</p>
  
  <p>(When running on IIS6 it didn't have this problem)</p>
  
  <p>Web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
              &lt;forms name=".AUTHCOOKIE" loginUrl="HomePage.aspx" defaultUrl="Loading.aspx" timeout="9480" /&gt;
    &lt;/authentication&gt;
  </code></pre>
  
  <p>MVC Routing (not sure it’s related):</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
          routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
          routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
          routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
          routes.IgnoreRoute("{resource}.gif/{*pathInfo}");
  
          routes.MapRoute("Actions", "A/{controller}/{action}", new { controller = "Tasks", action = "InitPage" });
  
      }
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Rafael</p>