A Tech Log

October 13, 2008

Returning a HTTP Respose Code from WCF Rest

Filed under: Development — adallow @ 9:26 am
Tags: ,

The WebOperationContext has a property called OutgoingResponse (which is of type OutgoingWebResponseContext) which in turn has a StatusCode property that you can set. WebOperationContext.Current is available for REST based WCF services in much the same way as HttpContext is available for ASMX/ASPX and ServiceContext is available for normal (non rest) WCF Services

     = System.Net.HttpStatusCode.OK;

Create a free website or blog at WordPress.com.