The title sound interesting right. So, in this post we are going to discuss about the custom error reporting in ASP.Net application.
source Code
We are going to use C#.Net code to trap and respond to errors when they occur in the ASP.net or rather I would say in our web application.
To trap the errors occurs we have written a separate class with the name ExceptionLog.cs, and we are using Global.asax to know about the error and trap through our ExceptionLog.cs class file and record the details into text file.
ExceptionLog.cs file:
In the class file we will write our logic to trap the errors occurred in application and logged that error details into text file.
The Log File:
As I had mentioned that the error details would get logged in textile with the name ErrorLog.txt
Global.asax
We will use the benefit of Global.asax to call error trap method on any Application error.
To know more about the Global.asax file you can visit below links:
1. http://en.wikipedia.org/wiki/Global.asax
2. http://msdn.microsoft.com/en-us/library/1xaas8a2(v=vs.71).aspx
3. http://www.dotnetcurry.com/ShowArticle.aspx?ID=126
4. http://support.microsoft.com/kb/306355
So here is the piece of code to catch the error occurred in the application and logged those into text file through our custom error logged class.
Hope it will be useful for you!!
Feel free to provide your comments and any suggestions!!
~jawed
source Code
We are going to use C#.Net code to trap and respond to errors when they occur in the ASP.net or rather I would say in our web application.
To trap the errors occurs we have written a separate class with the name ExceptionLog.cs, and we are using Global.asax to know about the error and trap through our ExceptionLog.cs class file and record the details into text file.
ExceptionLog.cs file:
In the class file we will write our logic to trap the errors occurred in application and logged that error details into text file.
The Log File:
As I had mentioned that the error details would get logged in textile with the name ErrorLog.txt
Global.asax
We will use the benefit of Global.asax to call error trap method on any Application error.
To know more about the Global.asax file you can visit below links:
1. http://en.wikipedia.org/wiki/Global.asax
2. http://msdn.microsoft.com/en-us/library/1xaas8a2(v=vs.71).aspx
3. http://www.dotnetcurry.com/ShowArticle.aspx?ID=126
4. http://support.microsoft.com/kb/306355
So here is the piece of code to catch the error occurred in the application and logged those into text file through our custom error logged class.
Hope it will be useful for you!!
Feel free to provide your comments and any suggestions!!
~jawed