WebAPI : Returning HttpResponseException RRS feed

  • Question

  • What is the proper way to return HttpResponseException?

    catch (Exception ex)
    throw new HttpResponseException(new System.Net.Http.HttpResponseMessage()
    Content = new System.Net.Http.StringContent(ex.Source),
    ReasonPhrase = ex.Message

    Getting this error message:

    Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.

    Friday, August 19, 2016 9:50 PM


  • I'd try them here in microsoft official IIS / ASP.Net forums






    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    • Proposed as answer by Mike Laughlin Monday, August 22, 2016 12:49 PM
    • Marked as answer by Just Karl Monday, August 29, 2016 6:54 PM
    Saturday, August 20, 2016 5:45 AM