ApiController.BadRequest 方法

定义

重载

BadRequest()

创建 (BadRequestResult 400 错误的请求) 。

BadRequest(ModelStateDictionary)

InvalidModelStateResult 创建具有指定模型状态的 (400 错误请求) 。

BadRequest(String)

BadRequestErrorMessageResult 使用指定的错误消息创建 (400 错误请求) 。

BadRequest()

创建 (BadRequestResult 400 错误的请求) 。

[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

返回

BadRequestResult

一个 BadRequestResult

属性

适用于

BadRequest(ModelStateDictionary)

InvalidModelStateResult 创建具有指定模型状态的 (400 错误请求) 。

[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

参数

modelState
ModelStateDictionary

要在错误中包括的模型状态。

返回

InvalidModelStateResult

具有指定模型状态的一个 InvalidModelStateResult

属性

适用于

BadRequest(String)

BadRequestErrorMessageResult 使用指定的错误消息创建 (400 错误请求) 。

[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

参数

message
String

用户可见的错误消息。

返回

BadRequestErrorMessageResult

具有指定错误消息的 A BadRequestErrorMessageResult

属性

适用于