Instead of just setting statuscode to 404... 

Throw an httpexception with a 404 statuscode, it's easier to catch handle and provide a friendly 404 message rather than an IIS 404 from the handler.