ApiController.StatusCode(HttpStatusCode) Method

Definition

Creates a StatusCodeResult with the specified status code.

[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

Parameters

status
HttpStatusCode

The HTTP status code for the response message

Returns

A StatusCodeResult with the specified status code.

Attributes

Applies to