ApiController.BadRequest Method

Definition

Overloads

BadRequest()

Creates a BadRequestResult (400 Bad Request).

BadRequest(ModelStateDictionary)

Creates an InvalidModelStateResult (400 Bad Request) with the specified model state.

BadRequest(String)

Creates a BadRequestErrorMessageResult (400 Bad Request) with the specified error message.

BadRequest()

Creates a BadRequestResult (400 Bad Request).

public:
 virtual Microsoft::AspNetCore::Mvc::BadRequestResult ^ BadRequest();
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.BadRequestResult BadRequest ();
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member BadRequest : unit -> Microsoft.AspNetCore.Mvc.BadRequestResult
override this.BadRequest : unit -> Microsoft.AspNetCore.Mvc.BadRequestResult
Public Overridable Function BadRequest () As BadRequestResult

Returns

BadRequestResult

A BadRequestResult.

Attributes

Applies to

BadRequest(ModelStateDictionary)

Creates an InvalidModelStateResult (400 Bad Request) with the specified model state.

public:
 virtual System::Web::Http::InvalidModelStateResult ^ BadRequest(Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual System.Web.Http.InvalidModelStateResult BadRequest (Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member BadRequest : Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary -> System.Web.Http.InvalidModelStateResult
override this.BadRequest : Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary -> System.Web.Http.InvalidModelStateResult
Public Overridable Function BadRequest (modelState As ModelStateDictionary) As InvalidModelStateResult

Parameters

modelState
ModelStateDictionary

The model state to include in the error.

Returns

InvalidModelStateResult

An InvalidModelStateResult with the specified model state.

Attributes

Applies to

BadRequest(String)

Creates a BadRequestErrorMessageResult (400 Bad Request) with the specified error message.

public:
 virtual System::Web::Http::BadRequestErrorMessageResult ^ BadRequest(System::String ^ message);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual System.Web.Http.BadRequestErrorMessageResult BadRequest (string message);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member BadRequest : string -> System.Web.Http.BadRequestErrorMessageResult
override this.BadRequest : string -> System.Web.Http.BadRequestErrorMessageResult
Public Overridable Function BadRequest (message As String) As BadRequestErrorMessageResult

Parameters

message
String

The user-visible error message.

Returns

BadRequestErrorMessageResult

A BadRequestErrorMessageResult with the specified error message.

Attributes

Applies to