1

I have a site hosted on IIS7 with a default document specified as default.aspx. This works fine but my app uses Forms Authentication and I want to disable Anonymous Authentication completely. When I do disable anonymous authentication for everything except the login page, everything works fine but the default document setting stops working.

With Anonymous authentication switched on if I visit http://mysite I get passed to http://mysite/default.aspx (which then redirects to the login page if the user hasn't already logged in)

If I disable anonymous authentication (leaving only forms based auth enabled) and I visit http://mysite I get a permission denied page from IIS. Yet, if I visit http://mysite/default.aspx directly then the site works fine.

I just want to disable anonymous authentication and have http://mysite go to http://mysite/default.aspx. Any ideas would be greatly appreciated.

John Rabotnik
  • 439
  • 2
  • 5

1 Answers1

0

Have you tried adding a defaultDocument entry in the "system.webServer" element of the Web.Config?

<system.webServer>
        <defaultDocument>
        <files>
            <add value="Default.aspx" />
        </files>
    </defaultDocument>
</system.webServer>

Also, the if you want the default page to show up to those who have not yet been signed into the application, you must allow access with an authorization section like below:

(in system.web)

 <location path="Default.aspx">
    <system.web>
      <authorization>        
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
Kenny
  • 520
  • 1
  • 8
  • 24
  • This is what I've been doing, it works fine with anonymous authentication enabled. But when I disable anonymous and only have forms auth enabled then **http://mysite** doesn't work (but *http://mysite/default.aspx* does work). Turning off anonymous auth seems to break the default page section. – John Rabotnik Jun 22 '10 at 10:44
  • Have you added an authorization section to allow unauthenticated users access to the default page? Assuming you want the app to work like that? – Kenny Jun 23 '10 at 07:53
  • Do you have an URL routing configured in the web.config? That can mess with you default doc. – russau Dec 22 '10 at 02:47