Search code examples
asp.netweb-configiis-10

Adding the <location> tag to web.config causes website folders to be inaccessible. How to fix?


I've added an application beneath my main website which is a newer version of the main website. The sub application named V2 will be used to preview changes to the main website.

In order to access V2 from the main website, I need to modify the web.config to enclose both the <system.web> and <system.webServer> tags in the <location path="." inheritInChildApplications="false"> tag.

The V2 website runs as expected (i.e. //main/V2) but all of the sub-folders in both main and V2 can't be read. The styles and images are in folders which are inaccessible. It seems like a permissions issue. The application is configured to allow all users full access to the root and all sub-directories.

    <authentication mode="None" />
    <authorization>
      <allow users="*" />
    </authorization>

What do I have to do to make all the sub-directories accessible?


Solution

  • The permissions issue was caused by the <location> tag in the web.config. The <system.webServer><validation> tag did not like being wrapped in the <location> tag so I pulled it out; like this.

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
      </system.webServer>
    
    <location path="." inheritInChildApplications="false">
      <system.webServer>
        ...
    

    Now all of the folders are readable.