Skip to content

Injecting IHttpModules

remogloor edited this page Mar 12, 2012 · 2 revisions

Injecting IHttpModules

Ninject.Web.Common lets you inject IHttpModules very easily. The only thing you have to do is to add a binding for your http module like this:

kernel.Bind<IHttpModule>().To<MyHttpModule>();

If you are deriving from NinjectHttpApplication you have to add the NinjectHttpModule to your web.config.

<configuration>
  <system.web>
    <httpModules>
      <add name="NinjectHttpModule" type="Ninject.Web.Common.NinjectHttpModule"/>
    </httpModules>
  </system.web>
</configuration>