Preventing ASP.NET Application From Starting

  • Thread starter Thread starter Cramer
  • Start date Start date
C

Cramer

Is there some way - perhaps in Application_Start - that I can prevent an
ASP.NET (3.5) application from starting.

I would like to perform some environment validation and pipeline
configuration during Application_Start - and if those efforts, themselves,
fail or have some runtime exception, then I want for the application to not
start (i.e., the Web site should not be available unless all of the startup
tasks complete without errors).

How can I accomplish this?

Thanks!
 
I know of no way you can make the entire application not available, but you
should be able to set a value that tells you something is wrong and then use
a base class for every page the person should not hit. I would still leave
the default page available and give a friendly error message to the user.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
 
Since the OP, I thought about the option to use the app_offline.htm
technique described here:
http://weblogs.asp.net/scottgu/archive/2005/10/06/426755.aspx

Apparently I could - upon detecting that the runtime conditions necessitate
making the entire system unavailable, programmatically copy app_offline.htm
to the root folder. While this would apparently make ASP.NET completely
unavailable - which is the intended goal - it would also/therefore mean that
I could not use ASP.NET to remove app_offline.htm from the root folder of
the site. So this technique, while quite effective and simplistic (which is
good!) would also mean that it should be reserved for the most serious of
error conditions that would necessitate a system administrator to be
manually fixing stuff on the Web server... and the last thing the system
administrator would do is manually remove app_offline.htm to make the entire
site once again available.

-Cramer
 
Back
Top