c# - How can I return a custom HTTP status code from a WCF REST method? -
if goes wrong in wcf rest call, such requested resource not found, how can play http response code (setting http 404, example) in operationcontract method?
there weboperationcontext
can access , has outgoingresponse
property of type outgoingwebresponsecontext
has statuscode
property can set.
weboperationcontext ctx = weboperationcontext.current; ctx.outgoingresponse.statuscode = system.net.httpstatuscode.ok;
Comments
Post a Comment