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

WebOperationContext.Current.OutgoingResponse.StatusCode 
     = System.Net.HttpStatusCode.OK;
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: