472,798 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,798 software developers and data experts.

How to force an ASP.NET web app to exit?

Hi,

We have an ASP.NET web application that attempts to check some database
conditions in Application_start to ensure that all is well before the app
comes up. However, I figure out how to force the app to exit if this
verification fails. Just throwing an exception doesn't seem to do the trick.
The app still comes up.

I feel like I should be able to call Application.exit() inside of
Application_start, but of course there is no such thing here.

What is the best way to accomplish this?

thanks
Robb
Jul 21 '05 #1
3 7290
Another way to say this is, I want to abort the startup. If that clarifies
what I'm trying to do.

thanks
Robb
Jul 21 '05 #2
You cant stop and application, technically you can abort startup with an
unhandled error exception like a file not found exception.
For application exceptions, the System.Web.HttpApplication class (the base
class for Global.asax) triggers the System.Web.HttpApplication.Error event
if you do not handle the error on the page or if you re-throw the exception
and this will terminate the application as it starts.

You can open, modfy and save the web.config file which will restart the
application on next requestshould you control the exception. Best if you
handle the false start and control your application shutdown and restart
however.
--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Robb Gilmore" <Ro*********@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Another way to say this is, I want to abort the startup. If that clarifies what I'm trying to do.

thanks
Robb

Jul 21 '05 #3
Typically, two ways to handle this:

1) your error handler would decide that the user shouldn't get access, so it
would respond with an HTML stream... effectively a web page produced by
code, that explains that an error occurred. It is good form to provide a
link to a useful home page.

2) create two virtual directories in your app: one public with an error page
(and a login page, and any other pages that are available to the general
public) and the other as an application. If the app doesn't start up,
redirect the user to the error page in the other vdir.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Robb Gilmore" <Ro*********@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com...
Hi,

We have an ASP.NET web application that attempts to check some database
conditions in Application_start to ensure that all is well before the app
comes up. However, I figure out how to force the app to exit if this
verification fails. Just throwing an exception doesn't seem to do the
trick.
The app still comes up.

I feel like I should be able to call Application.exit() inside of
Application_start, but of course there is no such thing here.

What is the best way to accomplish this?

thanks
Robb

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alberto | last post by:
I've a complex stored procedure, that makes a lot of insert, update, delete and so on. I would like to make some commits durint this sp, but of course they are not "real" commit because who call...
2
by: Sam Johnson | last post by:
Hi Is there any way to force my VB.NET application to unload itself regardless of any running threads? Of course, this can mean data loss, but is there any way to kill my own process immediately ...
6
by: Ray | last post by:
DB2 V7.2 Is it possible to list applications connected to a node by Auth ID? Is it possible to force applications connected to a node by Auth ID or am I forced to use App. Handle? Thanks, Ray
3
by: Robb Gilmore | last post by:
Hi, We have an ASP.NET web application that attempts to check some database conditions in Application_start to ensure that all is well before the app comes up. However, I figure out how to...
22
by: Br | last post by:
First issue: When using ADPs you no longer have the ability to issue a me.refresh to save the current record on a form (the me.refresh does a requery in an ADP). We usually do this before...
2
by: comp.lang.php | last post by:
class ReportGenerator { function ReportGenerator() {} /** * Generate the HTTP headers necessary for this file type. Can be called statically *
0
by: jinnareddy | last post by:
Hi, I'm unable to download a file that is having a 2-byte char in its name (e.g.テ) using force download option. Though, am able to download file names involving ASCII chars. I have tried URL...
41
by: Twayne | last post by:
Hi, How would I go about "forcing" a user from one page to another? I have a very simple random question/answer entrance requirement for an e-mail form. After 3 page views most people are...
9
by: Patrick Sona | last post by:
Hi all, Is it possible to force an ASP.NET web-application to exit? At application-startup I have to check and establish some database-connections. If there an error occours, the application...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.