Posts Tagged: exceptions


21
Sep 09

HOWTO: Log website errors using exceptions in ASP.NET

Defen­sive pro­gram­ming (ie. check­ing object for null before hav­ing an action on it) can be a great tool but do we always can pre­vent all the errors espe­cially when it comes to user inputs or web servers that not always reli­able. When appli­ca­tion is up and run­ning there are not many ways we can find out that some user had an error unless the error is global so appli­ca­tion goes down. Of course if we have an access to Win­dows Event Viewer on the server we can check it daily but in my hon­est opin­ion Event Viewer is quite hard to use.  Instead of that we can write our own Error­Log­ger. So each time user or server have a bug we will have a nice report on that. For error track­ing we will use .NET built in Excep­tion class and Try and Catch block.

Con­tinue reading →