Scott Hanselman

Free ASP.NET MVC eBook - Walkthrough

March 11, 2009 Comment on this post [40] Posted in ASP.NET | ASP.NET MVC | NerdDinner | Source Code
Sponsored By

imageToday is a pretty cool day. It's the culmination of a bunch of little stuff and a lot of hard work by some really nice dudes. Here's a few surprises.

Rob, Phil, and I have been working on the ASP.NET MVC book for a while. One (poorly kept) surprise is the inclusion of ScottGu as an author on the book. Between the four of us, we got enough forehead space for like six guys.

Here's where it gets cool.

Free ASP.NET MVC eBook

Today we're releasing the first 185 pages of the book as a FREE PDF download.

Not only that, it's licensed as Creative Commons Attribution No Derivatives. You can share, distribute, hand out, transmit it all you like. You can even include it in your own book if you'd like. ;)

We worked really hard on this chapter, but the real applause goes to ScottGu who closed down Starbucks a number of times, working late into the night. If you enjoy ScottGu's Epic Blog Posts, here's 185 pages of Epic. This chapter will be Chapter 1 in the book; kind of a book within a book.

The book itself is deep in production but this should hold you off for a while, I hope. ;)

Free ASP.NET MVC Sample Application - NerdDinner

Next, we're releasing the NerdDinner sample application at as MS-Pl. It's not nearly as sophisticated as the MVC Storefront, but it's pretty cool and does some nice stuff in a very clean way, in our opinion.

There's also more Full Application Samples to be had at with more to come soon!

Big thanks also to the NerdDinner style designer Michael Dorian Bach and to Dave Ward for his jQuery ninja skills. Thanks also to Steve Harman for his peer review. (I'm getting there! Soon...)

I'll be maintaining the application with all these folks, and you're welcome to join in! I'm hoping to add features like RSS, iCal, Blog Badges, jQuery UI controls, OpenID and more in the coming weeks. Wanna help?

Mix 09

I'll be presenting NerdDinner and the code at Mix 09 next week on Thursday at 2:30pm in session "T49F" called

"File|New -> Company: Creating with Microsoft ASP.NET MVC "

You can sign up for my talk by going to the Mix Session Builder, entering "T49F" and clicking on the "Green Plus Sign" next to the title.


About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
March 11, 2009 2:01
Nice job guys. Look forward to seeing the book.
March 11, 2009 2:06
Now THERE'S a collection of fiveheads.
March 11, 2009 2:31
Great stuff Scott. Lets hope this is a great way for people - with and without a ASP.NET background to get into the MVC Framework!

See you at Mix! :)
March 11, 2009 2:37
Thank you Scott and all of the others for this amazing job :)
March 11, 2009 3:12
Thank you Scott, and Phil and Rob and the Gu. I'll be at your MIX presentation next week for sure.
March 11, 2009 3:45
Great Job!

Thanks for release this code :)
March 11, 2009 7:07
Nice. I'll also be at your demo.
March 11, 2009 7:14
Super, I've been looking for a proper way to dig into ASP.NET MVC and this looks like the perfect way. I was thinking of buying this book when it is published, but that's still a number of months off--this will allow me to get a head start!
March 11, 2009 8:02

Any chance you could put me in touch with a speaker for an MVC talk April 8th (Wed) in Bellingham. 6pm ish. I run the Bellingham .NET UG. INETA member in good standing. Bellingham is about 1.5h north of Redmond/Seattle.

Thanks for any help,

March 11, 2009 9:20
Thank you scott, phil, the gu, rob, you guys really show the spirit of openness.
ASP.NET MVC is definitely the best thing that has ever come from Microsoft yet.
March 11, 2009 9:29
I'm a bit confused - CC No Derivatives says:

You may not alter, transform, or build upon this work.

So wouldn't that prevent people from "includ[ing] it in your own book"?

Just curious. :)
March 11, 2009 9:40
Noah - I voted for the "do whatever" license, but the publisher pushed back. If the chapter was "included" in a book, but the book itself didn't "build upon" the chapter, it's cool, as I read it.

BUT! The code itself is MS-PL, so they can totally build upon the code, just not extend Scott's Chapter. It's sub-optimal, but I'm REALLY trying to push for open-ness at every level. This is a pretty good start, I think...half a book for free.
March 11, 2009 10:11
Andy, email me privately?
March 11, 2009 12:26
Scott, any chance you can give Michael Dorian Bach a quick note that his site could use a little update?

I didn't spend all day looking for it, but his contact link seems to be missing.
I've been looking for some "public learning journey" like you and Phill happen to have from time to time, but for Silverlight.
It would be interesting to be able to follow Michael's Silverlight road trip, but I couldn't find any way to subscribe to a single post, tag or something like that.
His comments are disabled and his "Don't be a stranger. Say hello." link is just a line of text, not a link.


March 11, 2009 13:10
Scott, Do you have a standard stock image you use for the front of your books, they're all looking pretty similar.
March 11, 2009 13:26
Joe - Should I get a new photo each time I do a book? I'm still the same dude. Same haircut, same weight, same beard.
March 11, 2009 14:46
"Between the four of us, we got enough forehead space for like six guys." -- Big foreheads for big brains! This is the ASP.NET MVC book and project I've been waiting for! Thanks so much, guys!
March 11, 2009 16:31
So cool!

There is something happening in the world of .Net and Microsoft - awsome to get this book the day I'm at home looking after my three-year old. She's building with Lego, so I thought I could build some MVC.

Sadly the MVC software doesn't work. (No web page - no errors - installer reports some errors to the log). I'll read the chapter and pretend - but it would be even nicer if the software worked...

I'm running Vista Professional, VS 2008 Team System and some Sdks and stuff.

Some error log messages that seems to come from the install (the installer reported "Installation Successful"):
[...]file (ModelObjectItemVB_ASPNET.vstemplate). Invalid template element (TemplateID) value (Microsoft.Data.Entity.Design.VSTemplate.ModelObjectItemVB_ASPNET).
[...]file (WebDataService.vstemplate). Unknown attribute (_locID).
[...]file (csWPFBrowserApplication.vstemplate). Unknown element (EnableEditOfLocationField). Parsing will attempt to recover

(Installed only the mvc-download from a page referred from the download page the book pointed to)

Keep up the good work! Looking forward to listen to you at Norwegian Developers Conference again this summer.

March 11, 2009 16:41
Nice chapter. Better than I expected.
March 11, 2009 16:43
Super !!
March 11, 2009 18:13
A "book" about programming. What a cute idea! You could use this to look stuff up if your internets were broken. ;-)
March 11, 2009 18:15
BTW, Scott, your open ID implementation is still screwed up. I get

403 - Forbidden: Access is denied.
You do not have permission to view this directory or page using the credentials that you supplied.

When trying to log in using Yahoo. My Yahoo Open ID works fine on stackoverflow.
March 11, 2009 19:32
will there be a Kindle or eBook version of the final book?
chapter looks great!
March 11, 2009 20:18
You guys are REAL slackers!!!
You had the chance of being the first Wrox book in history where all authors could actually take a *real* picture together, and you let Wrox do the usual collage thing???

Just get a camera to the cafeteria next time you're together!

March 11, 2009 20:20
I've just been skimming through the free download part of the book, so I may be taking something out of context, but on page 88, the code does a try {...} catch {...}, and the intent of the catch is to display a validation error to the user. It assumes the exception was thrown as a result of bad input from the user (as shown on page 89). This isn't meant for production code is it? Doesn't this violate the rule of only catching exceptions that the program expects and can handle? Shouldn't it only be catching specific exceptions, not any exception? For instance, if the connection to the database is down for some reason won't the user keep being re-directed to a validation error even is nothing is wrong with the data?

I'm not trying to nit-pick. I'm was just trying to learn best practices while I make the transition to MVC.
March 12, 2009 0:55
Thanks for the feebie.
March 12, 2009 2:19
The ebook is really good.

Going through it today.

This is totally the shot in the arm I needed to dive in.


March 12, 2009 10:31
Hey Scott,

Is this book up to date with all the functionality in the current MVC RC-2 Build? Or is it based on older code?

March 12, 2009 10:51
cm - Yes, this is up to date with what will be the release version.
March 12, 2009 11:30
Hey Scott,

Firstly, kudos to you guys on showcasing the app.

One thing though, the live site did not pass the W3C markup validation test (at It would be nice to see this fixed.

March 12, 2009 19:08
Great work Scott, by the way do you know when we could expect first Release version of MVC (not RC)?
March 12, 2009 19:14
I still don't understand why I should care about mvc. I see more logic going into the html markup in mvc than web forms - and from what I've seen its highly breakable due to poor compiler support for all the items that are being put in quotes. Will this chapter enlighten me?
March 13, 2009 20:13
Hi, Scott!

How can I contact you? registration is not allowed. And I have a message for you.
March 13, 2009 20:48
Look closer...2idi registration isn't needed. Just an email address.
March 13, 2009 21:43

Thanks for this. I have just started getting my feet wet with MVC and am really excited with what I see so far. I am working my way through the e-book and have come across something that has got me. On page 81 it talks about adding a ControllerHelper class. Is there somewhere special we need to add this in order for all the Controllers to be able to use it. I wasn't sure how to encapsulate it. Thanks again for the e-book. It has made my friday more enjoyable.

March 13, 2009 21:49
A little digging and I found the source code. I think I can take it from here. Thanks anyways.
March 14, 2009 12:28
Applying dependency injection in NerdDinner Application using Unity Application Block
March 22, 2009 14:26
[quote]A "book" about programming. What a cute idea! You could use this to look stuff up if your internets were broken. ;-)[/quote]

There book has too many incomplete instructions in it [bugs?]. After I'd got about half-way through the tutorial it became increasingly difficult to carry on due to the mismatch between the code I was writing the the code I "should've wrote". I'm new to Ling and Mvc. There are just too many vital instructions missing from the tutorial. Providing so many detailed screen-shots has give you a false sense of security. You need to provide detailed errata which is updated with the missing information. In the manner that the old Wrox books used to have.

I'm not nit-picking - the book has serious problems with it and I doubt 90% of developers could easily complete the project by just following the book. After I'd got halfway through I was frequently reduced to using WinMerge to compare my version against the code-download version. Even doing that it's not easy to figure out (a) what needs to be added/changed to the current version of my project; (b) what needs to be added in later steps and (c) what is not essentil to get the project working.

It may have been more sensible to release this as a preview under the "Wrox First" or "Wrox Blox" series - then the book would've had an entry on the Wrox site and someone would've been given the responsibility of writing the errata.

Errata list please.

PS: I spent years of my life writing tutorials like this as I used to be an professional educator. So I know just how easily students get stuck and just how verbose an author needs to be.

Despite all that nit-picking. Thanks for the book.
April 11, 2009 2:40
Hiya Scott,

A comment and a question, if you will.

It might be good to add an instruction to the NerdDinner .pdf indicating the user add 'using System.Text.RegularExpressions;' to Dinner.cs. (Page 40/186). Not something people will normally trip over, but given the detail you're using in the writing, that may help.

As to the question: USA, UK and NL regex strings... interesting. As I am from NL: why this country? :)

April 27, 2009 10:43
You have done a great work too;
I'd like to congratulate you.
I'm waiting for more work.

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.