473,461 Members | 1,514 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Stopping ASP.NET application during Application_Start event

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
5 3485
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mridul Buragohain | last post by:
hi all! ===================================== my environment: MS .NET 1.1 with Service pack 1 ASP.NET framework IIS 5.0 C#.NET language. =====================================
4
by: Keith | last post by:
I'm in the same boat as the fellow who posted this message back in August: Title : Windows Service, How does one make a service "fail" properly? Author : Ross Bennett Group :...
3
by: SL | last post by:
All, As I understand it, a single application (i.e. IIS virtual directory) in ASP.NET may in fact have more than one corresponding HttpApplicationState object (more or less one per server...
6
by: jim | last post by:
Hi All, I like to know the life cycle of an ASP .NET Application( incudieng server application, such as .NET Web Service). That means from initialization to fully running and how to reboot it or...
3
by: simon | last post by:
In global.asax.vb I have: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application is started Application("OZN") = "HUF" End Sub But then on some the...
1
by: APA | last post by:
In the Application_Start event I load several static variables with data from the database that are critical to the execution of the application. My question is that during app start if a second...
4
by: =?Utf-8?B?bWFzbWl0aA==?= | last post by:
Can you restart an ASP.NET application in the Application_Start event when an error occurs so the next request for the application will fire the Application_Start event again? This would allow...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
1
by: nicerun | last post by:
I'm using the Application_Start event at Global.asax.cs to invoke thread that do some job. I know that Application_Start event occurs when the very first request to Web Application received. -...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.