Table of Contents

Class BadRequestErrorMessageResult

Namespace
System.Web.Http.Results
Assembly
System.Web.Http.dll

Represents an action result that returns BadRequest response and performs content negotiation on an see HttpError with Message.

public class BadRequestErrorMessageResult : IHttpActionResult
Inheritance
BadRequestErrorMessageResult
Implements
Inherited Members

Constructors

BadRequestErrorMessageResult(string, IContentNegotiator, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

Initializes a new instance of the BadRequestErrorMessageResult class.

public BadRequestErrorMessageResult(string message, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)

Parameters

message string

The user-visible error message.

contentNegotiator IContentNegotiator

The content negotiator to handle content negotiation.

request HttpRequestMessage

The request message which led to this result.

formatters IEnumerable<MediaTypeFormatter>

The formatters to use to negotiate and format the content.

BadRequestErrorMessageResult(string, ApiController)

Initializes a new instance of the BadRequestErrorMessageResult class.

public BadRequestErrorMessageResult(string message, ApiController controller)

Parameters

message string

The user-visible error message.

controller ApiController

The controller from which to obtain the dependencies needed for execution.

Properties

ContentNegotiator

Gets the content negotiator to handle content negotiation.

public IContentNegotiator ContentNegotiator { get; }

Property Value

IContentNegotiator

Returns System.Net.Http.Formatting.IContentNegotiator.

Formatters

Gets the formatters to use to negotiate and format the content.

public IEnumerable<MediaTypeFormatter> Formatters { get; }

Property Value

IEnumerable<MediaTypeFormatter>

Returns IEnumerable<T>.

Message

Gets the user-visible error message.

public string Message { get; }

Property Value

string

Returns string.

Request

Gets the request message which led to this result.

public HttpRequestMessage Request { get; }

Property Value

HttpRequestMessage

Returns HttpRequestMessage.

Methods

ExecuteAsync(CancellationToken)

public virtual Task<HttpResponseMessage> ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<HttpResponseMessage>

Returns Task<TResult>.