How to get error number in global.asax
-
Hello All, We have error handling code in global.asax. If any error occurs, it will send email to admin. We want to capture error number and depending on error numbers we would like to send email or no. We will put some error numbers in web.config and check if error number is presents in web.config then don't send email. How can we get error number in Global.asax. Any sample code or URL, it will be great.
Thanks & Regards, Kumar
-
Hello All, We have error handling code in global.asax. If any error occurs, it will send email to admin. We want to capture error number and depending on error numbers we would like to send email or no. We will put some error numbers in web.config and check if error number is presents in web.config then don't send email. How can we get error number in Global.asax. Any sample code or URL, it will be great.
Thanks & Regards, Kumar
-
Thanks. We have code as in KB example, its working but we want to know error number.
Thanks & Regards, Kumar
-
Thanks. We have code as in KB example, its working but we want to know error number.
Thanks & Regards, Kumar
The Exception Class has a protected member for HRESULT . If you derive a class from System.Exception, you can get access to that value. That should contain any 'number' associated to the error (if one was generated). HRESULT has 3 parts to it: a severity code, a facility code, and an error code. There is more detail here: http://msdn2.microsoft.com/en-us/library/system.exception.hresult(VS.71).aspx Example is there. Hope that helps... -Don
-
The Exception Class has a protected member for HRESULT . If you derive a class from System.Exception, you can get access to that value. That should contain any 'number' associated to the error (if one was generated). HRESULT has 3 parts to it: a severity code, a facility code, and an error code. There is more detail here: http://msdn2.microsoft.com/en-us/library/system.exception.hresult(VS.71).aspx Example is there. Hope that helps... -Don
Hello Don, Thank you for reply, I will check this.
Thanks & Regards, Kumar