Re: How do I show an error happening in Application_Start ?
From: Scott Allen (scott_at_nospam.odetocode.com)
Date: 01/31/05
- Next message: Scott C. Reynolds: "Re: Response.WriteFile help please"
- Previous message: Boonaap: "dropdown - javascript - to server - postback"
- Maybe in reply to: Kostadin Kostov: "Re: How do I show an error happening in Application_Start ?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 31 Jan 2005 10:22:52 -0500
Let's start with just the Init event questions:
Each HttpApplication instance does fire Init when it instantiates, but
these objects are then pooled and used throughout the life of the
application. It's possible then that you'll only see Init fired a
handful of times.
http://odetocode.com/Articles/89.aspx
Make sense?
-- Scott http://www.OdeToCode.com/blogs/scott/ On Mon, 31 Jan 2005 00:45:39 -0500, "msnews.microsoft.com" <REMOVETHIScuca_macaii2000@yahoo.com> wrote: >Me again - I'll try to be more explicit - if the error is in >Application_Start, I understand that the error will occur ONLY ONCE, after >I'm done with editing the global_asax file. When I run the project again, it >won't even pass by there, so in this case if I need to rely on some value >set in Application_Start I will be screwed. > >So I thought that this means that, to avoid this possibility, it is actually >not a good thing to have code in "Application_Start", but rather in "Init". >I read that the Init event is raised each time a new instance is created >(already this is *NOT* a very good thing, because I might want to execute >that code only once, and not once for each instance). However, to my grand >surprise, the same thing happens - my code, which is set to provoke an >error, is executed, again, only once - when I "F5" again in VS.Net, the >execution does not even pass by INIT. Is this NOT a new instance ??? > >Then I thought: Let's imagine that I need to cache a 'Settings' table to be >shared across all instances of my application, so I write code for reading >that table in "Application_Start". > >Let's say that this table belongs to the database "A" on server "SA". Let's >say that the rest of my app works with tables in the database "B" on server >"SB". What happens in the case where I start the app normally, and then SA >fails and I need to read that table again because the cache has been cleared >by the system ? Since the app will never pass thru "Application_Start" >again.... what can I do short of restarting SA and asking *ALL* the users to >restart their applications ? >What if one of the many users does not close the application ? That would >mean that all instances but one have been closed, and that would mean that >my application is still not closed i.e. I cannot execute the code in >Application_Start. > >Sorry, I'm very confused about this - Application vs. Instances, and error >handling, not to mention that not even INIT is executed on each run. Could >you please be so kind to clarify this for me ? > >Thank you for reading this long post. >Alex. >
- Next message: Scott C. Reynolds: "Re: Response.WriteFile help please"
- Previous message: Boonaap: "dropdown - javascript - to server - postback"
- Maybe in reply to: Kostadin Kostov: "Re: How do I show an error happening in Application_Start ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading