ControllerBase.BadRequest 方法

定义

重载

BadRequest()

创建一个 BadRequestResult 生成响应的 Status400BadRequest

BadRequest(ModelStateDictionary)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

BadRequest(Object)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

BadRequest()

创建一个 BadRequestResult 生成响应的 Status400BadRequest

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

BadRequestResult为响应创建的。

属性

适用于

BadRequest(ModelStateDictionary)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

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

BadRequestObjectResult为响应创建的。

属性

适用于

BadRequest(Object)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

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>]
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

BadRequestObjectResult为响应创建的。

属性

适用于