ViewResult Class

Definition

Represents an ActionResult that renders a view to the response.

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

Constructors

Properties

ContentType

Gets or sets the Content-Type header for the response.

Model

Gets the view data model.

StatusCode

Gets or sets the HTTP status code.

TempData

Gets or sets the ITempDataDictionary for this result.

ViewData

Gets or sets the ViewDataDictionary for this result.

ViewEngine

Gets or sets the IViewEngine used to locate views.

ViewName

Gets or sets the name or path of the view that is rendered to the response.

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