Dustin Horne

Developing for fun...

Dynamic Custom Error Pages in ASP.NET MVC 2

Recently, I had to implement a dynamic custom 404 error page in an ASP.NET MVC2 website.  My first instinct was to turn CustomErrors mode on and setup a 404 Error, but this failed to return my custom error page in a shared hosting environment and instead displayed the default IIS 404 page.  I'll walk you through fixing this in just a minute, but for now I want to show you how to create the custom 404 page. More...

Asymmetric Encryption and Signing with RSA in Silverlight

While Silverlight is a powerful tool for rich client applications, it lacks the ability to perform asymmetric encryption out of the box.  In this article, I'm going to share a cryptography class library I've been working on and show you how to use it to perform standards compliant RSA Encryption in Silverlight that is cross compatible with .NET's built in RSACryptoServiceProvider, allowing you to encrypt from Silverlight using my library and decrypt on your website using the RSACryptoServiceProvider.  For brevity, only examples using my class library will be shown except for a few examples that show equivelant functionality from the RSACryptoServiceProvider (RSACSP).

Update 11/24/2010: The Scrypt library has been updated.  Key generation is now performed Asynchronously to avoid blocking the UI thread and freezing the browser.  I've updated the applicable source samples in this article to reflect the changes.

More...

UI Updates With Databinding and INotifyPropertyChanged

Today I'm going to show you how easy it is to leverage the power of property binding in Silverlight.  I'm going to provide a very simplistic example that, while not very useful in itself, I hope will spark your imagination and show you how easy it is.  In my example I'm going to show you how to capture the position of the mouse over a canvas and keep the live updated mouse position in a separate class.  In addition, I'll show you how to update your UI directly (moving a box with the mouse and using labels to show the current mouse position) without directly wiring a single event to those controls in your page codebehind!

Before the MVVM pattern folks start foaming at the mouth over this article, I'd like to point out that this is meant to be a very simple demonstration and is not meant to be an MVVM application.  However, I will introduce you to a few concepts along the way that you will leverage in the MVVM design pattern.  I'm going to briefly introduce you to the DataContext object and I'll be storing the mouse data in a separate class but I will not create a complete Model-View-ViewModel separation for this example.  I will, however be encouraging a separation of UI and logic that will serve as a good starting place when you decide to dive into the world of MVVM.  Now, on with the show...

 More...