Can I control HTTP response codes when using WCF Exception Shielding?

Topics: Exception Handling Application Block
Feb 15, 2011 at 5:21 PM
Edited Feb 15, 2011 at 5:27 PM

Although WCF Exception Shielding is a very powerful solution to prevent inadvertently throwing sensitive information back to the client, I have run into a conflict. We are using WCF RESTful services for our remote mobile clients that depend on, say, an HTTP 401 when a secure service needs to be validated. Once I implemented the WCF Exception Shielding, ALL exceptions are being returned as a generic HTTP 500. Is there some way to control the HTTP response code?

Feb 15, 2011 at 10:45 PM

The out-of-the-box behavior doesn't support this.  A way around this would be to implement your own IExceptionHandler.


Gino Terrado
Global Technologies and Solutions
Avanade, Inc.