5
votes

I wanted to use FormsAuthentication to secure my static files as well on my site, so I followed the instructions located here http://learn.iis.net/page.aspx/244/how-to-take-advantage-of-the-iis7-integrated-pipeline/ under title "Enabling Forms Authentication for the Entire Application".

Now though, when I try to visit the site by going directly to http://www.mysite.com I get redirected to http://www.mysite.com/Login.aspx?ReturnUrl=%2f instead of it using my DefaultDocument I have set. I can go to my default document by just visiting http://www.mysite.com/Home.aspx without any issues because it is set to allow anonymous access.

Is there something I need to add into my web.config file to make iis7 allow anonymous access to the root? I tried adding with anonymous access but no such luck.

Any help would be much appreciated.


Both Home and the Login form allow anonymous.

<location path="Home.aspx">
 <system.web>
  <authorization>
    <allow users="*" />
  </authorization>
 </system.web>
</location>
<location path="Login.aspx">
 <system.web>
  <authorization>
    <allow users="*" />
  </authorization>
 </system.web>
</location>

Login form is set as the loginUrl

<authentication mode="Forms">
  <forms protection="All" loginUrl="Login.aspx">
  </forms>
</authentication>

Default document is set as Home.aspx

<defaultDocument>
  <files>
    <add value="Home.aspx" />
  </files>
</defaultDocument>

I have not removed any of the iis7 default documents. However, Home.aspx is first in the priority.

2
Post your web.config settings.Bryan
Also... is Home.aspx the only document listed in the default documents in IIS?Bryan
Please see my answer regarding removing the ExtensionlessUrl modules Forms Authentication Ignoring Default Document:Gregory Ostermayr

2 Answers

-1
votes

Did you try this:

<authorization>    
  <allow users="?" />  
</authorization>

I think that will fix it.