Application Start and Request events from a static constructor

Discussion in 'ASP .Net' started by ThazKool, Oct 6, 2006.

  1. ThazKool

    ThazKool Guest

    I would like to attach an event handler to the application start
    without having to use a Global.asax file. If this could be done from a
    static constructor then that would be ideal. I guess
    HttpContext.Current would be used. Also, I would like to attach an
    event to the first request and then remove it. Does anyone have any
    thoughts on how this can be done?

    Thanks,
    ThazKool
     
    ThazKool, Oct 6, 2006
    #1
    1. Advertising

  2. Do you want to rewrite all of ASP.NET, or just this part? :)

    You cna check to see if a piece of code has been fired and run it that way,
    but you are not going to get to a true static constructor scenario without
    overwriting a lot of the framework. A Singleton added to every page or to
    global.asax (which you do not want to use for some reason) will solve this.

    Or, if it is something you can do on first request, a singleton is a great
    option. Run the code on initial "instantiation" of the singleton.

    Without understanding the What (what you are wanting to do) and Why (why you
    think it has to be done this way), I cannot add much more.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com

    *************************************************
    Think outside of the box!
    *************************************************
    "ThazKool" <> wrote in message
    news:...
    >I would like to attach an event handler to the application start
    > without having to use a Global.asax file. If this could be done from a
    > static constructor then that would be ideal. I guess
    > HttpContext.Current would be used. Also, I would like to attach an
    > event to the first request and then remove it. Does anyone have any
    > thoughts on how this can be done?
    >
    > Thanks,
    > ThazKool
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 6, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tropos
    Replies:
    3
    Views:
    465
  2. Replies:
    4
    Views:
    4,131
    Alf P. Steinbach
    Mar 3, 2006
  3. Generic Usenet Account
    Replies:
    10
    Views:
    2,245
  4. albert kao
    Replies:
    3
    Views:
    2,026
    Arne Vajhøj
    Feb 2, 2011
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    373
    Chris
    Aug 30, 2005
Loading...

Share This Page