ControllerBase.BadRequest 方法

定义

重载

BadRequest()

创建生成 Status400BadRequest 响应的 BadRequestResult

BadRequest(ModelStateDictionary)

创建生成 Status400BadRequest 响应的 BadRequestObjectResult

BadRequest(Object)

创建生成 Status400BadRequest 响应的 BadRequestObjectResult

BadRequest()

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

创建生成 Status400BadRequest 响应的 BadRequestResult

public:
 virtual Microsoft::AspNetCore::Mvc::BadRequestResult ^ BadRequest();
[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:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

创建生成 Status400BadRequest 响应的 BadRequestObjectResult

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);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

参数

modelState
ModelStateDictionary

包含要返回到客户端的错误的 ModelStateDictionary

返回

为响应创建的 BadRequestObjectResult

属性

适用于

BadRequest(Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

创建生成 Status400BadRequest 响应的 BadRequestObjectResult

public:
 virtual Microsoft::AspNetCore::Mvc::BadRequestObjectResult ^ BadRequest(System::Object ^ error);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.BadRequestObjectResult BadRequest (object error);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.BadRequestObjectResult BadRequest (object? error);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

参数

error
Object

要返回到客户端的错误对象。

返回

为响应创建的 BadRequestObjectResult

属性

适用于