views:

129

answers:

1

Hello everyone,

I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 to develop an ASP.Net web site. I want to develop an Http module, which could inspect whether incoming request has some specific http header (e.g. CustomerID) and if do not have such header, I will redirect user request to some other pages.

I think I should develop by using Http Modules in IIS 7.0 integrated mode? Please correct me if I am wrong or there is simplier solutions. Any reference samples or tutorials? I am new to Http Module development in IIS 7.0.

thanks in advance, George

+3  A: 

There are a number of articles that describe how to create standard HttpModules for ASP.NET. One such article can be found in the ASP.NET infrastructure MSDN Library titled "Walkthrough: Creating and Registering a Custom HTTP Module".

Make sure that you follow the steps to register your module with IIS 7 Integrated mode on that walkthrough or you will end up with an error similar to the following:

"HTTP Error 500.0 - Internal Server Error Description: This application is running in an application pool that uses the Integrated .NET mode. This is the preferred mode for running ASP.NET applications on the current and future version of IIS. In this mode, the application should not specify ASP.NET module components in the / configuration section. Instead, it should use the / configuration section to load ASP.NET module components."

You can find another article on the IIS.NET site which has detailed information on how to create both modules and handlers for IIS 7. This article is titled "Developing IIS 7.0 Modules and Handlers with the .NET Framework"

tobint
Cool, tobint! Question answered!
George2