views:

1746

answers:

2

I have an asp.net (dynamic data) website set up as an application in a subdirectory of another site. This site requires different security settings from the top level site. Something like:

    <authorization>
       <allow roles="ADMIN"/>
       <deny users="*"/>
    </authorization>

These settings are ignored in the sub site. However, they work on the top level site, but even when set on the top level site, they are not inherited by the sub-site, and it's freely accessible. What could cause these settings to be ignored? I've tried adding:

<location path="." inheritInChildApplications="false">

to the top level web.config and then setting the above authorization rule in the sub site, even tried just denying all users. When visiting the site it looks like: http://mysite/mybrokensite

I am using windows authentication.

+2  A: 

I think the key thing is this

website set up as an application in a subdirectory of another site

If it's a separate application within IIS it should have it's own web.config file and the security settings can be set from there. So you'll have one web.config for the main site and one for the subsite. really they are two applications.

If it's just a subfolder under your website then this doesn't apply. It depends how you've set it up under IIS. If it's a seperate app then the icon will be a world/cabbage type icon. If it's a sub-folder they the icon will be ... well a folder.

Tim Brown
The website is set up as a separate application (has the cabbage type icon) and does have its own web.config. That's why I'm having trouble understanding why it won't read the web.config settings. I've tried setting the security settings in both web.configs (top and sub level sites) to no avail.
Have you got windows authenication set up for the sub site as well as the main site? i.e. right click the subsite, select properties, directory security tab then top edit button. By default it will be set to anonymous which will cause your settings to be ignored
Tim Brown
A: 

To elaborate on Tim's answer, make sure in IIS that it is set up as a virtual directory. Look at the property page for that directory in IIS Admin, Directory (or Home Directory) tab. If the Application label is greyed out, hit the Create button. Now IIS will load the web.config from that directory.

Bryan