Wondering if it's possible to override web.config custom errors on a per directory basis. I'm thinking not, but thought I'd ask.
Thanks,
Mark
Wondering if it's possible to override web.config custom errors on a per directory basis. I'm thinking not, but thought I'd ask.
Thanks,
Mark
The most straight forward way would be to create the web config for each directory explicitly. They should 'roll up' from MachineConfig
all the way to your lowest level directory.
Another post here on SO demonstrates how you might do this programmatically: https://stackoverflow.com/a/2260335/86860
There is an out-of-box solution for your query.
This step-by-step article describes how to use ASP.NET to make application-specific and directory-specific configuration settings. The Web.config file resides in the root directory of an ASP.NET application. The Web.config file specifies configuration information that is specific to the application. You can also set configuration settings on a per-directory basis. There are two ways to do so:
• Distribute multiple Web.config files to directories in the application. Add a Web.config file in the ASP.NET application directory with settings that override settings in a higher-level Web.config file or in the system machine configuration (Machine.config) file.
• Add per-directory or per-file settings directly to the application Web.config file. This method uses a single Web.config file to turn on per-directory configuration settings. You can also use this method in the Machine.config file to force configuration settings on ASP.NET Web applications and then to stop Web.config files from overriding Machine.config settings.
You can get more details from here: https://support.microsoft.com/en-in/help/815174/how-to-make-application-and-directory-specific-configuration-settings