Brief intro of rambling

http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework

The ASP.NET MVC Framework is a web application framework that implements the model-view-controller pattern. Based on ASP.NET, it allows software developers to build a Web application as a composition of three roles: Model, View and Controller.

Today’s agenda is to cover the three roles and contrast a bit to the now legacy Web Forms :)

Controllers

Create new empty MVC 2 project. Give brief tour of the project items and folders. End at Global.asax.cs.

Run and note the 404 error because there are no controllers. Create HomeController next to MvcApplication and run with success. Move HomeController to the normal place for good practices. Emphasize that controllers can live anywhere.

Create google action and return content from google.com

Views

Create MissingView action and show all the places the framework looks for that view by default

Create SimplePage action

Create SimpleControl action

Create ContentView action

Models

Create ModelsController and create CheesyPage action that passes data in ViewData

Create GoodPage action with model SampleViewModel

Advanced topics

Strongly typed master pages?

Open master page and go to definition on ViewMasterPage. Show the strongly typed version next to it in the object browser. Explain pitfalls of doing this.

Solution: RenderAction