256Microsoft Visual Studio 2010: A Beginner’s Guide
TIP
You can change your VS Web server’s port number. If you open your project’s property page by
For ASP.NET MVC, the important part of the URL is /Home/About. Home is the name of the Controller, and ASP.NET MVC appends Controller to the URL name, looking for the HomeController class, shown in Listing
http://localhost:1042/Home/Index
In a later section of this chapter, you’ll learn how ASP.NET MVC performs routing, which maps URLs to Controllers.
Both the Index and About actions in Listing
One more item to point out is how the Index action assigns a string to a collection
called ViewData. The ViewData collection is one way for a Controller to pass Model data to a View. I’ll cover more on Controllers, including how to create your own, in a later part of this chapter, but now, let’s do a quick review of Views so that you can see what happens when they are invoked by the Controller.
Displaying Views
A View is what displays in the browser and allows interaction with the user. The View can display any information that a Controller passes to it. For example, notice that the Index action in Listing