Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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>
share|improve this answer
    
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 mysite doesn't work (but 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 7:53
    
Do you have an URL routing configured in the web.config? That can mess with you default doc. –  russau Dec 22 '10 at 2:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.