views:

27

answers:

1

hey there

Once, to have a complete control over the head/body of HTTP messages - I use the Message class. To return some XML, for example, I call

  public Message ShowRunResults()
  {
    // some [OperationContract] implementation
    webContext.CreateTextResponse(result.ToString(), "application/xml", Encoding.ASCII);
  }

The question is how to return 404 not found or other HTTP codes? thanks a lot

+1  A: 

Using WebOperationContext.Current.OutgoingResponse you can set the HTTP code and status.

Regards,

Mazhar Karimi

Mazhar Karimi