ContentResult Class

Definition

An ActionResult that when executed will produce a response with content.

C#
public class ContentResult : Microsoft.AspNetCore.Mvc.ActionResult
C#
public class ContentResult : Microsoft.AspNetCore.Mvc.ActionResult, Microsoft.AspNetCore.Mvc.IActionResult, Microsoft.AspNetCore.Mvc.Infrastructure.IStatusCodeActionResult
Inheritance
ContentResult
Implements

Constructors

Properties

Content

Gets or set the content representing the body of the response.

ContentType

Gets or sets the Content-Type header for the response, which may be handled using MediaTypeHeaderValue.

StatusCode

Gets or sets the HTTP status code.

Methods

ExecuteResult(ActionContext)

Executes the result operation of the action method synchronously. This method is called by MVC to process the result of an action method.

(Inherited from ActionResult)
ExecuteResultAsync(ActionContext)

Executes the result operation of the action method asynchronously. This method is called by MVC to process the result of an action method.

Applies to

Product Versions
ASP.NET Core 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0