ApiController.StatusCode(HttpStatusCode) 方法

定义

StatusCodeResult创建具有指定状态代码的 。

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.StatusCodeResult StatusCode (System.Net.HttpStatusCode status);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member StatusCode : System.Net.HttpStatusCode -> Microsoft.AspNetCore.Mvc.StatusCodeResult
override this.StatusCode : System.Net.HttpStatusCode -> Microsoft.AspNetCore.Mvc.StatusCodeResult
Public Overridable Function StatusCode (status As HttpStatusCode) As StatusCodeResult

参数

status
HttpStatusCode

响应消息的 HTTP 状态代码

返回

具有 StatusCodeResult 指定状态代码的 。

属性

适用于