Tuesday, 17 March 2015

ASP.NET Tips #28 - Throwing HttpResponseExceptions

This is a very handy way to skip to the end of a processing chain when something goes wrong. Sure, you can return an HttpResponseMessage, but it will pass through the filters and handlers on its way out.

Throwing an HttpResponseException skips all that and goes right to the end. Use it with the same care you would use in throwing any exception.

No comments :

Post a comment