ControllerBase.BadRequest Method

Definition

Overloads

BadRequest(ModelStateDictionary)

Creates an BadRequestObjectResult that produces a Status400BadRequest response.

BadRequest(Object)

Creates an BadRequestObjectResult that produces a Status400BadRequest response.

BadRequest()

Creates an BadRequestResult that produces a Status400BadRequest response.

BadRequest(ModelStateDictionary)

Creates an BadRequestObjectResult that produces a Status400BadRequest response.

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

Parameters

modelState
ModelStateDictionary

The ModelStateDictionary containing errors to be returned to the client.

Returns

BadRequestObjectResult

The created BadRequestObjectResult for the response.

Attributes

BadRequest(Object)

Creates an BadRequestObjectResult that produces a Status400BadRequest response.

public:
 virtual Microsoft::AspNetCore::Mvc::BadRequestObjectResult ^ BadRequest(System::Object ^ error);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.BadRequestObjectResult BadRequest (object error);
abstract member BadRequest : obj -> Microsoft.AspNetCore.Mvc.BadRequestObjectResult
override this.BadRequest : obj -> Microsoft.AspNetCore.Mvc.BadRequestObjectResult
Public Overridable Function BadRequest (error As Object) As BadRequestObjectResult

Parameters

error
Object

An error object to be returned to the client.

Returns

BadRequestObjectResult

The created BadRequestObjectResult for the response.

Attributes

BadRequest()

Creates an BadRequestResult that produces a Status400BadRequest response.

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

Returns

BadRequestResult

The created BadRequestResult for the response.

Attributes

Applies to