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

  • Home
  • SEARCH
  • 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 7750519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:18:47+00:00 2026-06-01T11:18:47+00:00

Is there a way to subscribe to the HttpApplication’s BeginRequest event from Global.asax? What

  • 0

Is there a way to subscribe to the HttpApplication’s BeginRequest event from Global.asax?

What I want to do is add a line of code to the Application_Start method of Global.asax which will then subscribe an object I have to the BeginRequest and EndRequest methods.

I know this can be done through HttpModules, but I can’t use HttpModules for various reasons that I will not go in to.

The aim is to be able to add the same line of code to multiple websites’ global.asax pages.

  • 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-06-01T11:18:48+00:00Added an answer on June 1, 2026 at 11:18 am

    I’ve done some more digging, and have found out that the Init method is the way to go for me. I’m not convinved that the Global.asax constructor or the Application_Start method are the way to go. According to the MS docs:

    You should set only static data during application start. Do not set any instance data because it will be available only to the first instance of the HttpApplication class that is created.

    I’m interpreting that as: “Don’t register an event here because it won’t be available after the first request.”

    The Init method is called once for every instance of the HttpApplication class after all modules have been created.

    I’m interpreting that as: “Register your event here, because it will be registered for every new instance of the application, and the handler will not be dropped”.

    The key here is “after all modules have been created”. The constructor is called before this, so won’t be the right place. As for Application_Start, I’ve tried many times, but I cannot get the event registration to stick – which is proven by the docs.

    So I tried adding the code to the Init method and it worked just fine
    i.e.

    public void Init()
    {
        this.BeginRequest += attach your handler here;
        this.EndRequest += attach your other handler here;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there currently a way to subscribe to an event of a wrapped set,
is there way how to get name ov event from Lambda expression like with
Is there any way to subscribe from GWT to JSON objects stream and listen
Is there a way to subscribe somehow the workflow instance event when my workflow
Is there any way to implement publish subscribe push notification in Android ? At
Is there way in next piece of code to only get the first record?
Is there a way to creating an observable from a sequence in F#? The
Given a drop down list, is there any way to subscribe a javascript even
Is there a way to tell if an event is raised in it's own
FB.Event.subscribe('auth.login', function(response) { FB.api('/me', function(response){ //Some operation });}); Above piece of JavaScript code runs

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.