kaythihnin
asked on
Design ASP.Net C# Exception Handling Class
I am creating a shopping web site. I am new to 3 tier applications although I am not new to Asp.Net, C# and SQL server.
In Class Library, I am trying to implement Exception Handling Class which can handle all exception throw by both Asp.Net and Class Library and send email to Admin.
I tried to google it, but I only found basic exception handling, and Do and Dont about exception. What I am really looking for is either complete class as reference or any sample codes or article links or books. Thank you for your help.
http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx
In Class Library, I am trying to implement Exception Handling Class which can handle all exception throw by both Asp.Net and Class Library and send email to Admin.
I tried to google it, but I only found basic exception handling, and Do and Dont about exception. What I am really looking for is either complete class as reference or any sample codes or article links or books. Thank you for your help.
http://blogs.msdn.com/kcwalina/archive/2006/06/23/644822.aspx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi kaythihnin,
I don't know about anyone else's experience, but I have always managed fine using the global.asax class - it's there, and it seems to work, so in my opinion it would be a bit "overkill" to create a new class. Like I say, I couldn't comment on what anyone else does, that's just my opinion!
Daniel
I don't know about anyone else's experience, but I have always managed fine using the global.asax class - it's there, and it seems to work, so in my opinion it would be a bit "overkill" to create a new class. Like I say, I couldn't comment on what anyone else does, that's just my opinion!
Daniel
ASKER
Yes, I know about Global.asax.
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
Exception ex = Server.GetLastError();
using ( StreamWriter sw = new StreamWriter( HttpContext.Current.Server
{
sw.WriteLine( DateTime.Now.ToShortDateSt
Environment.NewLine +
ex.InnerException.ToString
Environment.NewLine +
Environment.NewLine );
}
Is that good enough to caputre all exception efficiently? Do I need a separate class in class library? I really want to know how professional web site catchs exception. Thank you in advance...