Asp – Is it possible to completely negate a “higher” web.config in a subfolder

asp.netweb.config

Is it possible to completely negate a web.config in a subfolder?

Obviously, I have a web.config in the root.

If I have a subfolder called "MyApp", can I write a bunch of code in there and have it run without any reference to the web.config at root? It would have its own web.config, and wouldn't even reference the "higher" web.config in root.

What I'm looking for is complete App isolation. I'd like to be able to write an app in a subfolder of an existing site, which ignores the entire web.config hierarchy above it — the app would an island all to itself.

I know I can use the "clear" element, but is that the best way? Just put a "clear" under every top level element? Just wondering if there's another way.

Duplicate of Will a child application inherit from its parent web.config?

Best Answer

Yes, you have to clear those sections want to override. Thinking about it a bit more, this makes sense, as the only way to clear everything might make it very hard to work out what to clear it to. Clear normally resets everything, including the root web.configs in the web.configs and machine.config defined in the frameworks /config folder on your server.

Note that you'll also lose access to the /bin folder, /app_code folder, etc. This may or may not be what you want.

Whether you can create sub-applications with your host is another matter to consider as well.