I have written some code in order to send a mail to the webmaster, every time an error occurs. I have placed this code in the Application_Error function of the file "global.asax.cs".
In the end, the errormessage will have to be mailed, but for now, all it is supposed to do, is send an e-mail. The code to do so, works fine if I include it in an aspx page of my own, however, the exact same code is not executed from the global.asax.cs file, when I trigger an error (by dividing a number by zero). However, I do get the "oops there was an error" page, or the correct asp.net error message when I set customErrors mode=off.
Since the function Application_Error was empty already, I suppose that CS had been configured NOT to handle errors through this function. So my 2 questions are:
1 - is my assumption correct and is Application_Error in global.asax.cs avoided/prevented to be executed in some way?
2 - if so, is there a way to work around this, so I can insert the code to send an email to the webmaster upon every error that is being generated an not handled by CS?