It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.
<customErrors mode="Off" defaultRedirect="customerrorpage.aspx"/>
Just for background information; Configuration information for an ASP.NET website is defined in one or more Web.config files. The configuration settings are applied in a hierarchical manner. There's a “global” Web.config file that spells out the baseline configuration information for all websites on the web server; this file lives in the
%WINDIR%\Microsoft.Net\Framework\version\CONFIG folder. You can also have a Web.config file in the root folder of your website. This Web.config file can override settings defined in the “global” Web.config file, or add new ones. Additionally, you may have Web.config files in the subfolders of your website, which define new configuration settings or override configuration settings defined in Web.config files higher up in the hierarchy.
Certain configuration elements in Web.config cannot be defined beyond the application level, meaning that they must be defined in the “global” Web.config file or in the Web.config file in the website's root folder. The
<authentication> element is one such example. The above error message indicates that there is a Web.config file in one of the website's subfolders than has one of these configuration elements that cannot be defined beyond the application level.
You have correctly identified the 2 possible approaches.
1 - Depending on the contents of your second web.config and if your setup would allow (i.e same authentication method) - add the
<authentication> settings and any other elements that should be define globally into the top web.config
2 - If you cannot merge then web.config contents then you should be able to turn the sub-folder into a web application in IIS by following the steps contained in this link http://www.tamilcodes.com/document.aspx?content=Tutorials&id=42 (if inaccessible, see archived) Hope this helps.