Table of Contents
To my sweet wife Kathy, who inspires me everyday.
Rob Conery
My wife, Akumi, deserves to have her smiling face on the cover as much as I do, for all
her support made this possible. And thanks to Cody for his infectious happiness.
Phil Haack
Thanks to my wife Mo and my sons Zenzo and Thabo for their unlimited supply of smooches.
Scott Hanselman
About the Authors
Rob Conery works at Microsoft on the ASP.NET team. He is the creator of SubSonic and was the chief architect of the Commerce Starter Kit (a free, Open Source eCommerce platform for .NET). He lives in Kauai, Hawaii, with his wife and two daughters (Maddy and Ruby).
Scott Guthrie is corporate vice president of Microsofts .NET Developer Division, where he runs the development teams responsible for delivering Microsoft Visual Studio developer tools and Microsoft .NET Framework technologies for building client and Web applications. A founding member of the .NET project, Guthrie has played a key role in the design and development of Visual Studio and the .NET Framework since 1999. Guthrie is also responsible for Microsofts web server platform and development tools teams. He has also more recently driven the development of Silverlight a cross browser, cross platform plug-in for delivering next generation media experiences and rich Internet applications for the Web. Today, Guthrie directly manages the development teams that build the Common Language Runtime (CLR), ASP.NET, Silverlight, Windows Presentation Foundation (WPF), IIS, Commerce Server, and the Visual Studio Tools for web, client, and Silverlight development. Guthrie graduated with a degree in computer science from Duke University.
Phil Haack is a senior program manager with the ASP.NET team working on the ASP.NET MVC project. Prior to joining Microsoft, Phil worked as a product manager for a code search engine, a dev manager for an online gaming company, and a senior architect for a popular Spanish language television network, among other crazy pursuits. As a code junkie, Phil Haack loves to craft software. Not only does he enjoy writing software, but he also enjoys writing about software and software management on his blog, http://haacked.com. In his spare time, Phil contributes to various Open Source projects and is the founder of the Subtext blog engine project, which is undergoing a rewrite, using ASP.NET MVC, of course.
Scott Hanselman works for Microsoft as a principal program manager in the Developer Division, aiming to spread the good word about developing software, most often on the Microsoft stack. Before this, he worked in eFinance for 6+ years and before that he was a principal consultant and a Microsoft Partner for nearly 7 years. He was also involved in a few things like the MVP and RD programs and will speak about computers (and other passions) whenever someone will listen to him. He blogs at www.hanselman.com and podcasts at www.hanselminutes.com and contributes to sites like www.asp.net, www.windowsclient.net, and www.silverlight.net. You can also find him on Twitter, far too often.
Credits
Associate Publisher
Jim Minatel
Development Editor
Maureen Spears
Technical Editors
Levi Broderick
Darren Kindberg
Production Editor
Kathleen Wisor
Copy Editor
Foxxe Editorial Services
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Vice President and Executive Group Publisher
Richard Swadley
Vice President and Executive Publisher
Barry Pruett
Project Coordinator, Cover
Lynsey Stanford
Compositor
Craig Woods, Happenstance Type-O-Rama
Proofreader
Nancy C. Hanger, Windhaven
Indexer
J&J Indexing
Acknowledgments
Thanks to my wife for her unflagging support. When Scott Guthrie showed me this pet project,
I told him I just had to work on it, so thanks to The Gu for helping to make that possible. Thanks to
Levi Broderick for all his editing help, to Brad Wilson for reviewing the chapter on TDD (I still owe you
a beer or two), to Eilon Lipton, the lead developer on ASP.NET MVC, for all his deep insight, and to the
rest of the MVC feature team (Carl, Fede, Jon, Keith, Simon etc.) for being so much fun to work with.
Phil Haack
Thanks to The Gu, and my boss Simon for their support in working on this book. Thanks to Phil Haack,
Eilon Lipton, Levi Broderick, and all the ASP.NET MVC guys for making such a rockin sweet framework.
Scott Hanselman
Introduction
Why does the world need Yet Another Web Framework?
This is the question that is most likely on your mind or perhaps its what you were thinking when you saw this book sitting on the shelf. We each asked ourselves this many times over the last few years.
Indeed there are many frameworks out there today flavored with every buzzword the industry can think of. In short, its easy to be skeptical. Yet as we, the authors, delve deeper into the latest and greatest web framework, were each starting to realize just how far the industry has come in the last 10 years.
Rob began programming for the Web with Classic ASP in 1997 and was giddy with excitement. When .NET came out, he remembers running around his office, stopping everyone from working and explaining that the world just tilted on its axis.
We all feel the same way about ASP.NET MVC. Not because its something different but because it offers developers the ultimate chance to do it their way. You dont like the way the platform renders the View? Change it! Just about every part of the ASP.NET MVC Framework is swappable if the shoes pinch, get different shoes. Dont like ties? Why not a bow tie? Youre totally in control.
ASP.NET MVC is a web framework that comes with a bunch of conventions to make your life easier when you follow them, but if you dont want them, the framework is quick to step out of your way so that you can get your work done in the way you like.
This book is going to go into the out-of-the-box experience youll have with ASP.NET MVC, but more importantly youll learn practical ways that you can extend ASP.NET MVC with your own magic then hopefully share that magic with others.
Because of this extensibility and attention to doing it your way, were happy to embrace Yet Another Web Framework and hope you are willing to come along with us for the ride.
Who This Book Is For
This book is for web developers who are looking to add more complete testing to their web sites, and who are perhaps ready for something different.
In some places, we assume that youre somewhat familiar with ASP.NET Web Forms, at least peripherally. There are a lot of ASP.NET Web Forms developers out there who are interested in ASP.NET MVC, so there are a number of places in this book where we contrast the two technologies. Even if youre not already an ASP.NET developer, you might still find these sections interesting for context, as well as for your own edification, as ASP.NET MVC may not be the web technology that youre looking for.