Hi Bobby,
we have not heard a lot of requests for it. We introduced RequestInterceptor for users to easily intercept the message very early in the WCF pipeline, and insert customized logic such as security check to process the request message.
I imagine a ResponseInterceptor would do the opposite. It would run very late in the WCF pipeline (possibly only before the transport channel), and run customized logic injected by the user. I can't see a good use case for this. Could you help me understand what you have in mind?
Have you considered modifying the reply message using the requestContext? The requestContext instance is available in the RequestInterceptor class.
You can do the following:
string errorHtml =
"<html><HEAD><TITLE>Request Error</TITLE></HEAD><BODY>" +
"<H1>Error processing request</H1><P>{0}</P></BODY></html>";
XElement response = XElement.Load(new StringReader(
string.Format(errorHtml, errorMessage)));
Message reply = Message.CreateMessage(MessageVersion.None, null, response);
HttpResponseMessageProperty responseProp = new HttpResponseMessageProperty()
{
StatusCode = statusCode
};
responseProp.Headers[HttpResponseHeader.ContentType] = "text/html";
reply.Properties[HttpResponseMessageProperty.Name] = responseProp;
requestContext.Reply(reply);
Is there a reason why that is not sufficient?