Application Start and Request events from a static constructor

T

ThazKool

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
 
C

Cowboy \(Gregory A. Beamer\)

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top