Search code examples
asp.netapplication-start

Stop execution of ASP.NET application


In my Application_Start() method, how can I stop the execution of the ASP.NET application when certain conditions are not met?

Throwing an exception doesn't appear to work.


Solution

  • i don't think that's possible; even if you could 'abort' the startup, the next attempt to access a URL from the site would try to start it again

    perhaps a static variable could be used to signal go/no-go, and begin_request could redirect to a placeholder page instead?