Craig Shoemaker takes you on a tour of the best ASP.NET MVC resources available today.
How have I missed jQuery all this time? I am really loving the support jQuery can provide for all kinds of things like AJAX and controls, but my favorite feature is the support for CSS3-like behavior that is available today in a cross-browser fashion.
Here is a script I used recently to "stripe" a table (provide alternating row colors).
$('table.striped tr:odd').css('background', '#eee');
Here are some community events that have come across my radar lately.
- DeveloperDeveloperDeveloper! Day Ireland - Saturday May 3rd 2008! This FREE developer event brings DDD to Galway!
- West Michigan Day of .NET May 10, 2008 -- Grand Rapids
- TechBash May 10, 2008 in Nanticoke, PA
ASP.NET MVC Resources
By now surely you have had at least some exposure to the new ASP.NET MVC framework. As with any new technology often times trying to find the quality resources to rely on may be a trying task.
<h3>Get the Latest</h3>
To help make your development experience more comortable the following is a list of 47 of the most interesting and helpful ASP.NET MVC resources available to-date. Now while we can all agree that this post becomes a legacy artifact as soon as I press the "Publish" button, make sure to frequently visit the links below for the latest ASP.NET MVC goodness:
- Frequent the Tags: Let the .NET community bring you the best MVC content on DotNetKicks, Technorati and del.icio.us
- Ask the Questions: Find out the answers to your burning questions on the official ASP.NET MVC forums
- Search the Web: Use Google to help you find posts and articles with the highest Google ranking and what's recently emerged in the blogosphere (rss)
</ul> <h3>Introductions & Architectural Overview</h3>
Let's start with a good foundation, shall we? The following links are a good read for the uninitiated as well as those who have had the bits since before preview 2.
- What is ASP.NET MVC and Where's It Going? Scott Guthrie details the ASP.NET MVC roadmap and announces the changes made to the ASP.NET MVC Preview 2 along with links to a five part tutorial series introducing the platform.
- MVC 101: Simone Chiaretta introduces the framework by explaining the technology along the natural breaking points. If you'd like to watch some demonstration
videos you can watch Scott Hanselman's excellent presentation from MIX08 and Jeffrey Palermo's
show over on DNRTV.
- ASP.NET MVC Request Lifecycle: Stephen Walther provides a detailed explanation of each step in the MVC request lifecycle. Making his post even more valuable is how he ends the piece by highlighting the extensibility points at each stage of the lifecycle.
- Why Not Support Post-Backs?: One of the most common questions of experienced WebForms people is, "Why throw out the control model?" This thread does a good job of addressing that issue.
- Want the Source?: You can download the MVC source code here.
- The Latest: Scott Guthrie announces pre-Preview 3 and Fredrik Normén gives you a step-by-step on working with the pre-Preview 3 release.
One of the first mindset shifts you have to make is to think up-front about the URLs on your site. The Routes Table is a new concept introduced along with MVC. These links will help you get started:
- Routes 101: The best place to start learning routes is Scott Guthrie's first tutorial on the subject.
- Placement: Most of the tutorials on routes show you how to set them up in the Global.asax. Having these
in a class require compliation and deployment to realize changes. To avoid these problems, Ian Suttle shows us how to
store routes in the database and Fredrik Normén has an example of how to maintain your routes in the web.config
(perhaps the most natural place).
- Upcoming Changes: Phil Haack details the upcoming changes to routes. In his words, "Isn’t preview code so much fun?" :)
Building the UI
Once you've got the basics down you are going to want to know how to execute some of the common tasks that you are used to doing under any development platform. These links will get you up-and-running.
- Component Controllers, User Controls or Views?: Mike Bosch shows you how to use the component controller class to render parts of views that do not rely on the main page's ViewData. Chris Sainty doesn't want to be stuck
with just using traditional user controls, but wants a "partial view" that you can provide with variable-based
parameters. When you want to use traditional user controls, Rob Conery wants to show you how to use ASP.NET user controls appropriately in an MVC application.
- UI Helper Methods: Rob also has more help for you to demonstrate how to use the UI Helpers to generate links, forms, buttons and more that automatically map to your controller classes.
- Pagination User Control: Robert Muehsig demonstrates how to build a pagination view user control.
</ul> <h3>Integration with the Familiar</h3>
Learn to use MVC with AJAX, the Membership framework as well as older versions of IIS.
- MVC + AJAX: Nikhil Kothari shows us how you can use the existing ASP.NET 2.0 AJAX framework with MVC.
- MVC + ASP.NET Membership: Make sure to remember that ASP.NET is much more than just the Page/Control paradigm of WebForms. Troy Goode has started an ASP.NET Membership Starter Kit
to help you get started adding membership to your site.
- MVC + IIS 5.1 & 6: A tenant of the MVC is extensionless URLs. Getting extensionless URL to work
on IIS versions earlier than IIS7 can be a difficult task. Charles Vallance shows you how to get your IIS 5.1 or 6 server
ready to serve an MVC site. James Geurts also offers a way to do the same thing in IIS6 using an ISAPI rewrite.
</ul> <h3>Implementing Security</h3>
Forms authentication is alive and well with MVC, but you need to interface with the system in a different way:
- Securing Controller Actions: While you will still use forms authentication, MVC is all about defining
resources via the URL so folder-based lock-downs don't make as much sense. The best way to add a secure layer to
your application is to secure controller actions.
- Using XML: Check this out! Azam Sharp shows you how to secure controller actions with an XML file.
As they say, REST has been around for a long time, but there are those of us who are just being introduced:
- Definition: Get the high-level story over on Wikipedia.
- REST 101: Ryan Tomayko explains REST to his wife in "How I Explained REST to My Wife" and we all win. Dino Esposito
also illustrates on the concepts of REST in MVC.
- REST + MVC: Rob Conery describes ASP.NET MVC in the context of REST. Aaron Lerch demonstrates how to build your site once and make it readable by both machines and humans.
- Validation Control Framework: Matt Hawley is working on a very nice validation framework for MVC that harnesses a lot of what already exisits in the
to check out the Validator Toolkit over on CodePlex as well.
- CAPTCHA: Helping to keep the bots out is Nick Berardi with an article on how to add CAPTCHA to your apps.
One of the main reasons of using MVC is to have the ability to fully test your applications.
- ASP.NET MVC Testing 101: ASP.NET MVC Framework – Part 2: Testing
- From the Ground Up: Rob Conery explores TDD while building an MVC application. Rob's just getting
started and we're expecting some great lessons by the time he's done.
- Testing Actions: Jeffrey Palermo discusses his experiences testing controller actions and offers how to streamline the process in the future.
</ul> <h3>Other Interesting Links</h3>
There is so much great content out there that all if it doesn't always fit into a tidy little category heading. Here are a few more gems I've found that are worth reading.
- Building RSS: Brad Abrams shows you step-by-step how to create a RSS feed with the new ASP.NET MVC Framework.
- Error Handling: Troy Goode shares how to build action filters to handle errors.
- Caching & Compression: Now that you have eradicated ViewState to stream less content across the wire, you can now
check out Kazi Rashid's excellent post on caching and compression.
- MVC Contrib: The MVC Contrib project didn't fit into a category simply because there is so much in it! Install the MVC Contrib bits to use with your MVC applications to swap out view engines, use different inversion of control (IoC) controller factories, UI and routing helpers and a whole lot more. Make sure to check out the docmentation and features page for a full list for a full list of what the project has to offer. If you want to see the MVC Contrib project in action, you can review the code over at Code Camp Server.
Blog posts and podcasts are great, but to really sink into the technology check out these books: