SORU
26 EYLÜL 2008, Cuma


Nasıl XML KALAN bir yöntem, özel bir HTTP durum kodu döndürebilir miyim?

Eğer bir şeyler ters giderse bir XML DİNLENME arama gibi talep edilen kaynak bulunamadı, nasıl oynayabilir miyim HTTP yanıt kodu (o ayar bir şey gibi HTTP 404, örneğin) benim OperationContract yöntemi?

CEVAP
26 EYLÜL 2008, Cuma


Erişebileceğiniz WebOperationContext ve ayarlanabilir StatusCode bir özellik olan tip OutgoingResponse özellik OutgoingWebResponseContext vardır.

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

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Gimpology.com Video Tutorials

    Gimpology.co

    3 ŞUBAT 2008
  • Huot Media

    Huot Media

    7 Mayıs 2010
  • Tutorials Junction

    Tutorials Ju

    1 Ocak 2014