CHAPTER 5

image

Views

In Chapter 4 you saw how action methods return an ActionResult. One of the most commonly used types of action results in an ASP.NET MVC application is the ViewResult. When you return a ViewResult from an action method, it indicates that ASP.NET MVC should invoke a view page to render HTML back to the client browser.

You store view pages in the Views directory inside the application. Views often include server-side code to produce the final HTML. When you create a view, you need to specify the view engine that will be used to process server-side code. Out of the box, ASP.NET MVC includes two view engines:

  • ASPX view engine: The ...

Get Beginning ASP.NET MVC 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.