which web.config to modify customerrors in admin pages?

Topics: ASP.NET 2.0
Nov 26, 2008 at 9:34 PM
Hi All: I've had BE 1.4.6 running for awhile on a website...and I moved the entire website to a new server a few months ago and it's been running OK there as well, but I just logged in as an admin to change some settings and when I click save I get the .net error page mentioning to turn off custom errors.

I thought at first it was a write-permissions error on the app_data directory, but I checked and both the "network service" and "asp.net" users have "change" permissions.

So I thought I'd turn off custom errors to see what the problem is, but it seems that I have three web.config files: in the webroot, in the BE application root, and in the admin folder itself, and setting "customerrors" to "off" in any of those files did not work?
Nov 28, 2008 at 10:02 PM
Hi All: Just responding to my own post. The problem I experienced had to do with inheritance in the nested web.config files.

In the end, I was able to fix the problem by turning off inheritance in the root application's web.config by wrapping <system.web> with:

<location path="." inheritInChildApplications="false">
    <system.web>
        ...
    </system.web>
</location>

Hopefully this will help someone in the same situation.

Dec 4, 2008 at 2:46 PM
i think i have this very problem.... but when I had the <location path="." inheritInChildApplications="false"> to my parent application web.config i get unrecognized attribute errors in the file and my application still wont compile without errors.
could it be that IIS is not configure properly..  if i look at the valid attrributes of the <location> tag it only shows path and allowOverride??

If i look at the application properties in IIS it says its using ASP.Net version 2.050727  i assume thats all correct..

if anyone has any idea I would be verry greatful.
Dec 4, 2008 at 2:59 PM
Hi jjme88:

If you use "inheritInChildApplications='false'" then you should not have any BE-specific code in your parent web.config, and your sub-application web.config should be the one pre-configured in the BE source. AFAICT IIS will respect these settings as long as the BE directory is configured as a separate application in IIS.

When you receive errors compiling, are you compiling your entire web app with the sub-app for BE? Or are you just compiling the BE app itself? What are the compile errors?

If you're still having problems you could try the reverse -- remove the sub-application from the project and include all your BE configuration in the parent web.config. Then you just have to adjust the paths in the web.config to include the sub-directory.
Dec 4, 2008 at 3:23 PM
hi dotnetnoob thanks for the fast response..

I get the following error;

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unrecognized attribute 'ininheritInChildApplications'. Note that attribute names are case-sensitive.

Source Error:

Line 13: 		</sectionGroup>
Line 14: 	</configSections>
Line 15: 	<location path="." ininheritInChildApplications="false">
Line 16: 		<system.web>
Line 17: 			<!--


I may have to try your suggestion.. Is it a simple case of taking everything in the root blogengine web.config  and mergng it very carefully into my parent application web.config? as ugly as it maybe..

I would really like to resolve the aboce error though it feels like ISS does not recognise it or something...

thanks for your help on this
Dec 4, 2008 at 3:38 PM
Hi jjme...look at your code...there's a typo:
<location path="." ininheritInChildApplications="false">
you have "ininherit" instead of "inherit" (happens to the best of us!)
Dec 4, 2008 at 3:46 PM
thanks for that boy do i feel stupid!!

everything does appear to work but ... my only problem is Visual studio 2005 still does not recognize it as a valid tag.. I believe thats a know thing with 2005.. will find out when my VS 2008 arrives...

thanks.