共用方式為


ControllerBase.StatusCode 方法

定義

多載

StatusCode(Int32)

藉由指定 statusCode來建立 StatusCodeResult 物件。

StatusCode(Int32, Object)

藉由指定 statusCodevalue 來建立 ObjectResult 物件

StatusCode(Int32)

來源:
ControllerBase.cs
來源:
ControllerBase.cs
來源:
ControllerBase.cs

藉由指定 statusCode來建立 StatusCodeResult 物件。

public:
 virtual Microsoft::AspNetCore::Mvc::StatusCodeResult ^ StatusCode(int statusCode);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.StatusCodeResult StatusCode (int statusCode);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member StatusCode : int -> Microsoft.AspNetCore.Mvc.StatusCodeResult
override this.StatusCode : int -> Microsoft.AspNetCore.Mvc.StatusCodeResult
Public Overridable Function StatusCode (statusCode As Integer) As StatusCodeResult

參數

statusCode
Int32

在回應上設定的狀態代碼。

傳回

為回應建立 StatusCodeResult 物件。

屬性

適用於

StatusCode(Int32, Object)

來源:
ControllerBase.cs
來源:
ControllerBase.cs
來源:
ControllerBase.cs

藉由指定 statusCodevalue 來建立 ObjectResult 物件

public:
 virtual Microsoft::AspNetCore::Mvc::ObjectResult ^ StatusCode(int statusCode, System::Object ^ value);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ObjectResult StatusCode (int statusCode, object value);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ObjectResult StatusCode (int statusCode, object? value);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member StatusCode : int * obj -> Microsoft.AspNetCore.Mvc.ObjectResult
override this.StatusCode : int * obj -> Microsoft.AspNetCore.Mvc.ObjectResult
Public Overridable Function StatusCode (statusCode As Integer, value As Object) As ObjectResult

參數

statusCode
Int32

在回應上設定的狀態代碼。

value
Object

ObjectResult上設定的值。

傳回

為回應建立 ObjectResult 物件。

屬性

適用於