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

屬性

適用於