Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Application Start and Request events from a static constructor

Reply
Thread Tools

Application Start and Request events from a static constructor

 
 
ThazKool
Guest
Posts: n/a
 
      10-06-2006
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

 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      10-06-2006
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: oups.com...
>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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
Private constructor,Static constructor plmanikandan@gmail.com C++ 4 03-03-2006 08:01 AM
Problem: shared object loading runs constructor of a static object, but static linkage does not. tropos C++ 3 11-30-2005 04:54 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57