Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6155849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:30:32+00:00 2026-05-23T20:30:32+00:00

We are running a webforms project at my company and I have an HttpModule

  • 0

We are running a webforms project at my company and I have an HttpModule that I need to resolve dependencies for.

We use the Ninject.Web library to resolve dependencies for master pages, pages, user controls, web services, and HttpHandlers. All these have base classes you can inherit from in the Ninject.Web Namespace:

  • MasterPageBase
  • PageBase
  • WebServiceBase
  • HttpHandlerBase
  • And a custom one we added since for some odd reason it wasn’t there: UserControlBase

However I am unable to find a HttpModuleBase. There is a NinjectHttpModule, but that is not a base class, it is a real module that tries to eliminate the need to inherit from base classes in pages and user controls, but it has some bugs and we are not using it.

What is the best way to resolve my dependencies in my HttpModule?

When I google this I come up with this question on the first page -_-

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:30:32+00:00Added an answer on May 23, 2026 at 8:30 pm

    I’m kind of amazed that nobody has answered this all day! Looks like I stumped you guys 🙂

    Well, I solved the issue. I wrote my own custom implementation of IHttpModule and compiled it into the Ninject.Web assembly myself. Here is the source of the base class I added:

    namespace Ninject.Web
    {
        public class HttpModuleBase : IHttpModule
        {
            /// <summary>
            /// This method is unused by the base class.
            /// </summary>
            public virtual void Dispose()
            {
    
            }
    
            /// <summary>
            /// Ininitialize the module and request injection.
            /// </summary>
            /// <param name="context"></param>
            public virtual void Init(HttpApplication context)
            {
                RequestActivation();
            }
    
            /// <summary>
            /// Asks the kernel to inject this instance.
            /// </summary>
            protected virtual void RequestActivation()
            {
                KernelContainer.Inject(this);
            }
        }
    }
    

    I simply modeled it after the other base classes in the Ninject.Web assembly. It appears to be working wonderfully. Just make your HttpModule inherit from Ninject.Web.HttpModuleBase and then you are free to use property injection within your module, like this:

    public class AppOfflineHttpModule : HttpModuleBase
    {
        [Inject]
        public IUtilitiesController utilitiesController { get; set; }
    
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ASP.NET webforms project in .NET 3.5 running locally on my machine
I have an ASP.NET 4.0 WebForms site that is running on a IIS6/Server 2003
I have a web site written in ASP.NET WebForms. I need to distribute the
I have an ASP.NET Web Forms app that I am building and running against
I have a .NET 4.0 Web Forms app that I am running with the
Running ipconfig /all shows a Teredo Tunneling Pseudo-Interface. What is that? Does this have
I have a standard ASP.Net WebForms application running on IIS 7.0 with an Integrated
Our company is currently running a asp.net Webforms 3.5 website as the default website
When developing WebForms web site, I start my project once, Cassini loads and stays
Currently I'm working on Web project that is built using ASP.NET Web Forms. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.