ApiController.BadRequest 方法

定义

重载

BadRequest()

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

BadRequest(ModelStateDictionary)

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

BadRequest(String)

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

BadRequest()

Source:
ApiController.cs
Source:
ApiController.cs

创建 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

属性

适用于

BadRequest(ModelStateDictionary)

Source:
ApiController.cs
Source:
ApiController.cs

创建具有 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具有指定模型状态的 。

属性

适用于

BadRequest(String)

Source:
ApiController.cs
Source:
ApiController.cs

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 指定错误消息的 。

属性

适用于