the one in subdirectory is supposed to overwriting the settings in the root directory, but i cannot get it, any ideas? thanks a lotWelcome to the ASP.NET forums, ding xiao liang.
First, are you referring to your ASP.NET application on your own computer, or on a commercial web host?
Second, what settings are you trying to override?
Dear Ding Xiao Liang
If you are having another web.config in subfolder, it should override settings from base (higher level folder) providing they are overridable attributes. If you don't want them to be overridden, add the attribute allowOverride in the location tag
<configuration>
<location path="myApplication" allowOverride="false">
</location>
</configuration
and it will not override higher level configuration file. I just checked overriding the customErrors attribute. At root folder, my web.config says
<configuration>
<system.web>
<compilation debug="false"/>
</system.web>
<system.web>
<customErrors mode="On" defaultRedirect="pages/errPage.aspx" />
</system.web>
</configuration
while in a sub folder I needed debugging enabled, therefore the folder specific web.config reads:
<configuration>
<system.web>
<customErrors mode="Off" />
<compilation debug="true"/>
</system.web>
</configuration>
On running a deliberate erroneous code,
<%="Hello World";%
it gives me expected error message.
Compiler Error Message: BC30037: Character is not valid.
Yes, one thing more to consider is allowOverride in Machine.config file. Refer to MSKB 815174; HOW TO: Make Application and Directory-Specific Configuration Settings in an ASP.NET Application.
"When the allowOverride attribute is false, the Web.config files in the Web application directories cannot override the settings that you specified in the <location> element."
http://support.microsoft.com/default.aspx?scid=kb;EN-US;815174#4
Hope it helps.
-Adnan Masood
0 comments:
Post a Comment