By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,474 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,474 IT Pros & Developers. It's quick & easy.

Stopping ASP.NET application during Application_Start event

P: n/a
If I would like to stop an ASP.NET application after some initialization
error during the "Application_Start" event (which I have caught within a
catch clause) – what is the right way to do it?
--
Thanks
Eric
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
You could try to add a check in session_on start to call the applications on
end event under a certain set criteria, that would allow app start to
conclude cleanly and should terminate your application.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Eric Dan" <no****@stopspamming.com> wrote in message
news:C0**********************************@microsof t.com...
If I would like to stop an ASP.NET application after some initialization
error during the "Application_Start" event (which I have caught within a
catch clause) - what is the right way to do it?
--
Thanks
Eric

Nov 19 '05 #2

P: n/a
Thanks. But I didn't really understand the answer.

Calling my implementation of the event "Application_End" will have no effect
on the system. Did you mean calling another method?

Assuming that I have decided to stop the ASP.NET application what exact
method should I call?

Eric

"John Timney (ASP.NET MVP)" wrote:
You could try to add a check in session_on start to call the applications on
end event under a certain set criteria, that would allow app start to
conclude cleanly and should terminate your application.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Eric Dan" <no****@stopspamming.com> wrote in message
news:C0**********************************@microsof t.com...
If I would like to stop an ASP.NET application after some initialization
error during the "Application_Start" event (which I have caught within a
catch clause) - what is the right way to do it?
--
Thanks
Eric


Nov 19 '05 #3

P: n/a
Restarting an Application is not doable
on the .Net Framework 1.0 nor 1.1.

In the .Net Framework 2.0, you can call Application.Restart()

For 1.0 and 1.1, you might be able to devise a workaround
which would consist of a System.IO call to "touch" your
global.asax file.

That would, in fact, restart your 1.0 or 1.1 application..

You should be careful if you want this to happen without
your intervention, whether by simply opening global.asax
in any editor and re-saving the file so that the file's date
is updated, or by running a web page which does that
( if you do that, make sure it's a password-protected page ).

The reason is that you could be starting an endless loop
( an error occurs, so the application is restarted, which
leads to the error occurring again, looping until you notice it... )


Juan T. Llibre
ASP.NET MVP
===========
"Eric Dan" <no****@stopspamming.com> wrote in message
news:A7**********************************@microsof t.com...
Thanks. But I didn't really understand the answer.

Calling my implementation of the event "Application_End" will have no
effect
on the system. Did you mean calling another method?

Assuming that I have decided to stop the ASP.NET application what exact
method should I call?

Eric

"John Timney (ASP.NET MVP)" wrote:
You could try to add a check in session_on start to call the applications
on
end event under a certain set criteria, that would allow app start to
conclude cleanly and should terminate your application.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Eric Dan" <no****@stopspamming.com> wrote in message
news:C0**********************************@microsof t.com...
> If I would like to stop an ASP.NET application after some
> initialization
> error during the "Application_Start" event (which I have caught within
> a
> catch clause) - what is the right way to do it?
> --
> Thanks
> Eric


Nov 19 '05 #4

P: n/a
Thanks a lot for the answer.

Anyway I think that MS should think also of a scenario of calling
Application.Stop() in a case where the problem cannot be resolved and we
would want to prevent from entering a loop.

Eric

"Juan T. Llibre" wrote:
Restarting an Application is not doable
on the .Net Framework 1.0 nor 1.1.

In the .Net Framework 2.0, you can call Application.Restart()

For 1.0 and 1.1, you might be able to devise a workaround
which would consist of a System.IO call to "touch" your
global.asax file.

That would, in fact, restart your 1.0 or 1.1 application..

You should be careful if you want this to happen without
your intervention, whether by simply opening global.asax
in any editor and re-saving the file so that the file's date
is updated, or by running a web page which does that
( if you do that, make sure it's a password-protected page ).

The reason is that you could be starting an endless loop
( an error occurs, so the application is restarted, which
leads to the error occurring again, looping until you notice it... )


Juan T. Llibre
ASP.NET MVP
===========
"Eric Dan" <no****@stopspamming.com> wrote in message
news:A7**********************************@microsof t.com...
Thanks. But I didn't really understand the answer.

Calling my implementation of the event "Application_End" will have no
effect
on the system. Did you mean calling another method?

Assuming that I have decided to stop the ASP.NET application what exact
method should I call?

Eric

"John Timney (ASP.NET MVP)" wrote:
You could try to add a check in session_on start to call the applications
on
end event under a certain set criteria, that would allow app start to
conclude cleanly and should terminate your application.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Eric Dan" <no****@stopspamming.com> wrote in message
news:C0**********************************@microsof t.com...
> If I would like to stop an ASP.NET application after some
> initialization
> error during the "Application_Start" event (which I have caught within
> a
> catch clause) - what is the right way to do it?
> --
> Thanks
> Eric


Nov 19 '05 #5

P: n/a
In that scenerio, if you are able to catch that unresolvable 'problem', you
probably should just redirect to a static error page that is simply served
up by IIS bypassing any process by ASP.NET.

MattC
"Eric Dan" <no****@stopspamming.com> wrote in message
news:68**********************************@microsof t.com...
Thanks a lot for the answer.

Anyway I think that MS should think also of a scenario of calling
Application.Stop() in a case where the problem cannot be resolved and we
would want to prevent from entering a loop.

Eric

"Juan T. Llibre" wrote:
Restarting an Application is not doable
on the .Net Framework 1.0 nor 1.1.

In the .Net Framework 2.0, you can call Application.Restart()

For 1.0 and 1.1, you might be able to devise a workaround
which would consist of a System.IO call to "touch" your
global.asax file.

That would, in fact, restart your 1.0 or 1.1 application..

You should be careful if you want this to happen without
your intervention, whether by simply opening global.asax
in any editor and re-saving the file so that the file's date
is updated, or by running a web page which does that
( if you do that, make sure it's a password-protected page ).

The reason is that you could be starting an endless loop
( an error occurs, so the application is restarted, which
leads to the error occurring again, looping until you notice it... )


Juan T. Llibre
ASP.NET MVP
===========
"Eric Dan" <no****@stopspamming.com> wrote in message
news:A7**********************************@microsof t.com...
> Thanks. But I didn't really understand the answer.
>
> Calling my implementation of the event "Application_End" will have no
> effect
> on the system. Did you mean calling another method?
>
> Assuming that I have decided to stop the ASP.NET application what exact
> method should I call?
>
> Eric
>
> "John Timney (ASP.NET MVP)" wrote:
>
>> You could try to add a check in session_on start to call the
>> applications
>> on
>> end event under a certain set criteria, that would allow app start to
>> conclude cleanly and should terminate your application.
>>
>> --
>> Regards
>>
>> John Timney
>> ASP.NET MVP
>> Microsoft Regional Director
>>
>> "Eric Dan" <no****@stopspamming.com> wrote in message
>> news:C0**********************************@microsof t.com...
>> > If I would like to stop an ASP.NET application after some
>> > initialization
>> > error during the "Application_Start" event (which I have caught
>> > within
>> > a
>> > catch clause) - what is the right way to do it?
>> > --
>> > Thanks
>> > Eric
>>
>>
>>


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.