ApiController.BadRequest Method
Namespace: System.Web.Http
Assembly: System.Web.Http (in System.Web.Http.dll)
Overload List
Name | Description | |
---|---|---|
BadRequest() | Creates a BadRequestResult. |
|
BadRequest(ModelStateDictionary) | Creates an InvalidModelStateResult with the specified model state. |
|
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
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
modelState
Type: System.Web.Http.ModelBinding.ModelStateDictionaryThe model state to include in the error.
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
message
Type: System.StringThe user-visible error message.
Return Value
Type: System.Web.Http.Results.BadRequestErrorMessageResult
An InvalidModelStateResult with the specified model state.
Return to top