Monday, November 24, 2003

Directory Picker Pro in C#


In my latest project I needed a dialog for picking a directory. I searched through the web, but found nothing that looked nice. First of all I wanted a TreeView for display, and I wanted to view all system drives (with correct names and icons).


How to use:

DirPicker DP = new DirPicker();
DP.ShowDialog();
if(DP.Result==DirectoryPickerResponse.Ok)
{
MessageBox.Show("Ok: "+ DP.SelectedDirectory);
}
else
{
MessageBox.Show("Cancel!");
}

Simple huh?


Go to the url above for source code.

Wednesday, September 03, 2003

Error Logging in ASP.NET

All coders are quite familiar with error messages. They are quite handy when developing stuff but you dont want them around after the release of your system and the users dont really think they are too funny.

So, how can we get rid of these ugly messages and still get nice information when your functions break down? I have written some code (with some inspiration from other error logging examples) that provide your system with some nice features:

  • On error, it redirects the user to a page that in English explains that an error has occurred.
  • You can set the object to either send an email or write in the EventLog, or both.
  • All the browser information is included in the email for support help.
  • It can also present an Alert message to the user
Read the article:
http://www.c-sharpcorner.com/UploadFile/pohlrobert/ErrorLoggingInASPNet11142005060841AM/ErrorLoggingInASPNet.aspx