3. March 2008 22:12
Today I was writing an HttpModule and was registering the module in the web.config under system.web. My module was not being called and I couldn't figure out why. After some trial and error I discovered the problem was that I was using IIS 7 in Integrated Mode which requires you to add your HttpModules and HttpHandlers under <system.webServer><modules></modules><handlers></handlers></system.webServer>. I added it under the right place and it worked. Then I was thinking my production server runs under IIS 6 (Windows 2003 Server) and it would suck to have to change it everytime I move the web.config so I decided to still use the HttpModule under system.web and the modules under system.webServer. If you do that you also have to add <validation validateIntegratedModeConfiguration="false" /> under system.webServer so you don't get a nasty, but descriptive IIS error.