Skip to content

Archive for April, 2009

19
Apr

C# Crash report – How to handle remote crash report with HTTP POST

Objective: Make your applications report any unhandled crash to a database on a remote server.
Description:You have a Reporter class that will send the values to page accepting POST data. The application main entry point will be surrounded by a Try Catch block (effectively catching every possible unhandled errors in the application). It will then try to send the stack trace of the error to the webpage. If it can’t (ie. no internet connection, server down) it won’t do anything and the application quits.

It can be very useful to catch those bugs you didn’t see or thought possible without mass testing and QA…which, let’s face it, you can’t afford as a self programmer. Your users are your testers! :P
A word of caution though, you might want to warn your users you’re sending data, and what kind of data you’re sending before using this. In this example, it doesn’t warn the end user.

On to the code below the break!

Read moreRead more