Partager via


ApiController.BadRequest Method

 

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

Overload List

Name Description
System_CAPS_protmethod BadRequest()

Creates a BadRequestResult.

System_CAPS_protmethod BadRequest(ModelStateDictionary)

Creates an InvalidModelStateResult with the specified model state.

System_CAPS_protmethod BadRequest(String)

Creates an T:System.Web.Http.Results.ErrorMessageResult (400 Bad Request) with the specified error message.

See Also

ApiController Class
System.Web.Http Namespace

Return to top

ApiController.BadRequest Method ()

Creates a BadRequestResult.

Syntax

protected internal virtual BadRequestResult BadRequest()
public protected:
virtual BadRequestResult^ BadRequest()
abstract BadRequest : unit -> BadRequestResult
override BadRequest : unit -> BadRequestResult
Protected Friend Overridable Function BadRequest As BadRequestResult

Return Value

Type: System.Web.Http.Results.BadRequestResult

A BadRequestResult.

Return to top

ApiController.BadRequest Method (ModelStateDictionary)

Creates an InvalidModelStateResult with the specified model state.

Syntax

protected internal virtual InvalidModelStateResult BadRequest(
    ModelStateDictionary modelState
)
public protected:
virtual InvalidModelStateResult^ BadRequest(
    ModelStateDictionary^ modelState
)
abstract BadRequest : 
        modelState:ModelStateDictionary -> InvalidModelStateResult
override BadRequest : 
        modelState:ModelStateDictionary -> InvalidModelStateResult
Protected Friend Overridable Function BadRequest (
    modelState As ModelStateDictionary
) As InvalidModelStateResult

Parameters

Return Value

Type: System.Web.Http.Results.InvalidModelStateResult

An InvalidModelStateResult with the specified model state.

Return to top

ApiController.BadRequest Method (String)

Creates an T:System.Web.Http.Results.ErrorMessageResult (400 Bad Request) with the specified error message.

Syntax

protected internal virtual BadRequestErrorMessageResult BadRequest(
    string message
)
public protected:
virtual BadRequestErrorMessageResult^ BadRequest(
    String^ message
)
abstract BadRequest : 
        message:string -> BadRequestErrorMessageResult
override BadRequest : 
        message:string -> BadRequestErrorMessageResult
Protected Friend Overridable Function BadRequest (
    message As String
) As BadRequestErrorMessageResult

Parameters

Return Value

Type: System.Web.Http.Results.BadRequestErrorMessageResult

An InvalidModelStateResult with the specified model state.

Return to top