integrated vs. classic iis pipeline support in web.config

Jun 22, 2011 at 5:38 PM

For our project we need to register both http handlers and http modules in NuGet.

I've seen people just dropping their "<add..." nodes in both the <system.web> and the <system.webServer> sections and then set

<validation validateIntegratedModeConfiguration="false" />

What if the user already has <validation validateIntegratedModeConfiguration="true" /> for some reason, we don't want to change that but

also if we don't, the site breaks in integrated mode with the httpmodule entries in <system.web>.

I don't think there is actually a way to figure out from the web config whether the site runs in integrated or classic mode.

You can check for: <validation validateIntegratedModeConfiguration="true" />

now you can assume, it is integrated mode and can add your modules and handlers only in  <system.webServer>

If <validation validateIntegratedModeConfiguration="false" /> then you could drop them in both sections because it wouldn't break.

What if there is no validateIntegratedModeConfiguration, then it defaults to true under integrated mode, but is ignored under classic.

What if there is no  <system.webServer>, I can still not assume that it is running in classic mode.

Even if I could figure out what pipeline mode the site is running under, could I use standard web.config transformations to build this conditional logic?

Has anybody done this?