Let's Dig into Some Code!
The simplest way to get a web page up and running on the new MVC framework is to create a route and a class that implements the IController interface. First I'll show you how to create a route to map http://www.partywithpalermo.com/rsvp
to an RsvpController.
public class Global : HttpApplication
protected void Application_Start(object
sender, EventArgs e)
public class RsvpController : IController
public void Execute(HttpContext context,
Note that you must have the following set up in web.config
The ControllerModule class creates a handler for the request; therefore, there is no need to configure the handler in the web.config
file. If you're running on IIS 6 or higher, you must enable wildcard mappings. On IIS 5, create a "*"
mapping to ASP.NET, so that every request gets routed through the ASP.NET engine. By default, IIS will try to serve requests that appear to be at the directory level.
Note that I can match a URL with the controller that should handle it. I'm not required to use a view but to merely implement an Execute
method. Now let me take it further and take advantage of the Controller base class. I'll extend the controller so that it can list all attendees who have RSVP'd.