Click here to Skip to main content
15,886,100 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi team,

I am working on aso .Net web application. I have to send email notification in the fallowing scenarios.
1)whenever my application will get crashes.
2)I am using 3rd party services So whenever 3rd party service down/crash then I have to send mail.
3)whenever Database down.

In above scenarios I have to send email notification.

Note: I have implement this code in Applivation_End event but this event not getting fired.

Please help me how to resolve this problem.

Thanks,
Jayaram

What I have tried:

I have implement this code in Applivation_End event but this event not fired.
Posted
Updated 17-Feb-19 22:01pm
Comments
Afzaal Ahmad Zeeshan 16-Feb-19 15:44pm    
And so this event is not being hit?

I recommend against this approach, catch the error as it is raised and log it (or send an email from there), do not wait until everything collapses.
Kornfeld Eliyahu Peter 17-Feb-19 9:41am    
This means (except of the application crash) that you have to poll constantly the DB and 3rd party services to see if they are well and alive...
It is a very time/resource consuming thing to do, and basically goes against the disconnected nature of the web... You must have to have a very serious reason to do this, otherwise just go with exception handling...

1 solution

The Application_End event only ever gets fired when the IIS pool is restarted (or a couple of other less relevant cases), not when your web page crashes due to unavailable DB or whatever. In a web app, the app is running while any user is connected and using it, and it doesn't get shutdown for a single user's problem.

Your best approach is to pepper your website with try...catch blocks and use those to send your emails. The only other approach is to have a separate app that polls the DB and service at frequent intervals - and that's a bad idea unless this is a safety critical system (and even then, you probably want to handle things rather better in terms of design than your question implies you have!)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900