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 3213580
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:57:40+00:00 2026-05-17T14:57:40+00:00

I’m implementing a simple HttpModule, where I want some code to run when the

  • 0

I’m implementing a simple HttpModule, where I want some code to run when the web application is started. But I’m surprised to find that the Application_Start event I would normally use from Global.asax is not available from a HttpModule. Is that correct, or am I missing something here?

How do I hook into the Application_Start event from an HttpModule?

Update:
I’ve come to simple solution using the Init event instead, but it still smells a bit funny to me.

  • 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-17T14:57:40+00:00Added an answer on May 17, 2026 at 2:57 pm

    You CAN use HttpModule to handle application start event

    Contrary to others that only write/believe what they read I’ve done my own part and found out it’s possible to handle Application start using an HTTP module. It’s a bit of a hack really but it reliably works. It’s definitely not something someone should avoid, because I’ve seen it in MS modules as well (namely Sharepoint 2010 SPRequestModule) This blog post of mine (Writing a custom IHttpModule that handles Application_Start event) will get you all the information you need to know about this. I’ve done it myself and it simply works. But you have to be a bit careful when using common resources, because your application may start behaving weird. To avoid this I suggest you read an additional blog post of mine, that explains why this happens and how to avoid it.

    If you want it to be thread safe as well, you can also lock execution and then mark module as application started. It’s the safest way of doing it.

    private static bool isStarted = false;
    private static object moduleStart = new Object();
    ...
    if (!isStarted)
    {
        lock(moduleStart)
        {
            if (!isStarted)
            {
                // handle aplication start
                ...
                isStarted = true;
            }
        }
    }
    

    I’ve created my own library that hooks to existing applications like Sharepoint 2010. I don’t want to change Global.asax of Sharepoint now do I? Using technique explained in the blog post, I was able to hook into it. Easily.

    And I guess this is exactly what you’ve been looking for. Hooking into start event of an arbitrary application by adding a module into web.config. Do it this way. It will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was implementing some simple Producer/Consumer program that had some semaphores and shared memory.
I'm implementing readability test and have implemented simple algorithm of detecting sylables. Detecting sequences
I've found Tapku Graph http://duivesteyn.net/2010/03/07/iphone-sdk-implementing-the-tapku-graph-in-your-application/?utm_source=twitterfeed&utm_medium=twitter ... which looks cool and fairly simple to implement
Put simple, I cannot find a way to easily display furigana in a JLabel.
I'm developing simple image sharing site to train my ruby-on-rails-fu. I have following resources
I'm checking a simple moving average crossing strategy in R. Instead of running a
I've written a simple COM DLL inproc server with a single simple COM object.
I'm implementing List interface to a class which stores data in a <T> type
I'm diving into ASP.NET MVC and I'm coming from a Ruby on Rails background.

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.