Preventing ASP.NET Application From Starting

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!
 
C

Cowboy \(Gregory A. Beamer\)

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.
 
F

Frank Lund

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
 

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

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top