.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to log the exceptions in ASP.NET globally?

Posted By: Jean Paul     Posted Date: September 30, 2010    Points:2   Category :ASP.Net
Create Application_Error event in the Global.asax file and use the Server.GetLastError() method.

Example:
protected void Application_Error(object sender, EventArgs e)
{
LogError(Server.GetLastError());
}

Responses
Author: Amit Mehra             
Posted Date: September 30, 2010     Points: 5   

Hi,

Better you have one error page which you can call on error Application_Error and have the log exception logic in separate error page Page load event.



Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Akhil Raj       [Moderator]      
Posted Date: October 02, 2010     Points: 5   

hi we can found more typesof techiniques for error handling.. .You can use suitable for your situation....anyway i will give some good articles here

http://www.codeguru.com/csharp/.net/net_asp/miscellaneous/article.php/c12385

http://www.vbdotnetheaven.com/UploadFile/akukreja/CustomError04122005032405AM/CustomError.aspx

some more may be in...

http://www.codeproject.com/KB/exception/

Author: Deco             
Posted Date: October 02, 2010     Points: 5   

DECLARE the class globally which has the method GetLastError()

then call that in application_error event

Regards,
Deco


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend