An action result is an object representing the response produced by an MVC action method. The action result system encapsulates reusable responses such as rendered views, redirects, and authorization prompts. section 2.3.3
Common action-result behaviors include:
- Return a ViewResult so Razor locates a view and renders an HTML response. section 2.3.3
- Return a RedirectResult to send the browser to another URL. section 2.3.3
- Return an HttpUnauthorizedResult to prompt the user to log in. section 2.3.3
Listing 2.7 Rendering a view in the HomeController.cs file in the Controllers folder
using Microsoft.AspNetCore.Mvc;
namespace FirstProject.Controllers {
public class HomeController : Controller {
public ViewResult Index() {
return View("MyView");
}
}
}
A HomeController action returns a named ViewResult, demonstrating the concrete MVC code behind rendered responses. section 2.3.3



