ODataHttpRequestMessageExtensions.CreateODataErrorResponse Method (HttpRequestMessage, HttpStatusCode, ODataError)

 

Note: This API is now obsolete.

Helper method that performs content negotiation and creates a HttpResponseMessage representing an error with an instance of ObjectContent<T> wrapping oDataError as the content. If no formatter is found, this method returns a response with status 406 NotAcceptable.

This method requires that request has been associated with an instance of HttpConfiguration.

Namespace:   System.Net.Http
Assembly:  System.Web.Http.OData (in System.Web.Http.OData.dll)

Syntax

[ObsoleteAttribute("This method is obsolete; use the CreateErrorResponse method from the System.Web.Http.OData.Extensions or System.Web.OData.Extensions namespace.")]
public static HttpResponseMessage CreateODataErrorResponse(
    this HttpRequestMessage request,
    HttpStatusCode statusCode,
    ODataError oDataError
)
public:
[ObsoleteAttribute("This method is obsolete; use the CreateErrorResponse method from the System.Web.Http.OData.Extensions or System.Web.OData.Extensions namespace.")]
[ExtensionAttribute]
static HttpResponseMessage^ CreateODataErrorResponse(
    HttpRequestMessage^ request,
    HttpStatusCode statusCode,
    ODataError^ oDataError
)
[<ObsoleteAttribute("This method is obsolete; use the CreateErrorResponse method from the System.Web.Http.OData.Extensions or System.Web.OData.Extensions namespace.")>]
static member CreateODataErrorResponse : 
        request:HttpRequestMessage *
        statusCode:HttpStatusCode *
        oDataError:ODataError -> HttpResponseMessage
<ObsoleteAttribute("This method is obsolete; use the CreateErrorResponse method from the System.Web.Http.OData.Extensions or System.Web.OData.Extensions namespace.")>
<ExtensionAttribute>
Public Shared Function CreateODataErrorResponse (
    request As HttpRequestMessage,
    statusCode As HttpStatusCode,
    oDataError As ODataError
) As HttpResponseMessage

Parameters

Return Value

Type: System.Net.Http.HttpResponseMessage

An error response wrapping oDataError with status code statusCode.

See Also

ODataHttpRequestMessageExtensions Class
System.Net.Http Namespace

Return to top