I have written a custom http handler. I have done this by writing a class which implements the IHttphandler.
Inside that class I have code like this,
For more details about this exception visit http://support.microsoft.com/kb/977453