ControllerBase.StatusCode 方法

定义

重载

StatusCode(Int32)

通过指定 statusCode创建 StatusCodeResult 对象。

StatusCode(Int32, Object)

通过指定 statusCodevalue 来创建 ObjectResult 对象

StatusCode(Int32)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
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)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
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 对象。

属性

适用于