Free ASP.NET MVC eBook Tutorial

bookcover[1] There has been a lot of excitement in the community about the new ASP.NET MVC framework that is about to ship (literally any day now – announcement coming soon).  As with anything new, people are also asking for more tutorials/samples/documentation that cover how to get started and build applications with it.

Over the last few months I’ve been helping to contribute to an ASP.NET MVC book that Scott Hanselman, Rob Conery, and Phil Haack have been writing for Wrox.  The book is now in production, and will be available to buy in stores soon (you can pre-order it on Amazon today).

I wrote the first chapter of the book – which is a 185 page end-to-end tutorial that walks-through building a small, but complete, ASP.NET MVC application from scratch.  The agreement I made with Wrox was that I’d write it for free in return for them also making it available as a free PDF download.

I’m excited to announce that you can now download this free end-to-end tutorial chapter (it is a 14mb PDF file). It’s licensed under a “Creative Commons Attribution No Derivatives” license – which means you can share, distribute, print, or hand it out to anyone.

NerdDinner ASP.NET MVC Tutorial

The tutorial starts by using the File->New Project command in Visual Studio to create a brand new ASP.NET MVC project, and then incrementally adds functionality and features.  Along the way it covers how to:

  • Create a database
  • Build a model with validation and business rules
  • Implement data listing/details UI on a site using Controllers and Views
  • Enable CRUD (Create, Update, Delete) data form entry
  • Use the ViewModel pattern to pass information from a Controller to a View
  • Re-use UI across a site using partials and master pages
  • Implement efficient data paging
  • Secure an application using authentication and authorization
  • Use AJAX to deliver dynamic updates
  • Use AJAX to add interactive map support
  • Perform automated unit testing (including dependency injection and mocking)

The application the tutorial builds is called “NerdDinner”. It provides an easy way for people to organize, host and search for new topic-based dinners online:

nerddinner_small[1]

Scott Hanselman has been hosting NerdDinners for years, and came up with the idea of building the tutorial around an application that facilitates this.  He is also now hosting a live custom-skinned version of the application at www.nerddinner.com)

Download Links

Hope this helps,

Scott

P.S. The book is entering production now and so is officially in un-edited status (meaning professional editors haven’t gone through it yet).  We’ll update the PDF with any important edits once the text is final.

P.P.S. And yes – this is one of the reasons my blog has been more quiet than normal the last few months.  Expect more regular blog posting again soon once I recover from this. :-)

Published Tuesday, March 10, 2009 2:54 PM by ScottGu

Comments

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:05 PM by André Medeiros

Great! Your blog has always been a source of valuable information re. ASP.NET MVC.

*clicks download*

Thanks for all the helpful insight. Have a great (but hopefully quick) recovery.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:09 PM by Chris Hardy

Fantastic stuff Scott!

See you at Mix 09, I owe you dinner. :)

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:12 PM by Efosa O.

Happy to have you back Scott, it has been a while! :)

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:29 PM by Robsta

Excellent, Muchas gracias.

looking forward to reading 'Implement efficient data paging'.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:44 PM by Carlos Figueroa

Thank you Scott! I'll be doing the tutorial this weekend and let you know. By the way I downloaded the book right after I read the new from a ScottHa's tweet but I was the 40th person requesting the download. I think tweeter is delaying my messages.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 6:49 PM by yaip

Great! As if blogging and running a big team wasn't enough. Now you write a book!

:)

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:02 PM by Bill

A simple "Thank You very much" is overdue from me.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:13 PM by Red Feet

Thanks Scott!

It's been a while, so I guess Microsoft will be releasing a lot of good stuff soon!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:14 PM by pure.krome

Awesome work Gents! Please please please understand that all your (and Rob, Scott and Phil's) work with this is _greatly_ appreciated! The best thing that's happened to developers since .NET was released!

I'm wearing a helmet because this is gonna blow my mind.....

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:36 PM by Denny Ferrassoli

Excellent! Much appreciated, I have also pre-ordered the book. Can't wait.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:41 PM by schuttsm

wow!  Thanks for all you do

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 7:47 PM by Andrew

Let me echo the comment of @pure.krome - you guys are doing a sterling job!

Keep up the fantastic work gents!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 8:02 PM by Sergey P.

Thanks! Nice tutorial!!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 8:11 PM by David

Hey Scott,

I can't believe how detailed this tutorial is. Awesome. And: If this is the First Chapter, how long is the whole book going to be?

David

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 8:18 PM by John

This is awesome! Thanks Scott.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 8:42 PM by Stephen

Great to have you back in the mix....  can't wait for MVC to hit "gold"

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:00 PM by Adam A

The timing of this could not be better!

Thank you so much Scott and the rest of the ASP.NET MVC team!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:02 PM by bhen

Gracias Scott, it's really great.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:06 PM by Steve Gentile

And your next book will be how to code this same exact functionality in Silverlight right  :)

Silverlight for Nerds...Dinner

Nice work Scott

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:10 PM by pierslawson

As many tutorials as possible are appreciated... some time back yousaid you were working on some more walkthroughs... will they be coming with 1.0?

Piers

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:15 PM by pure.krome

Hi again GuruGu,

i don't want to sound rude, but i think i found to typos on (book) page 181.

Current:

// Arrange

var controller = CreateControllerAs("SomeUser");

Should be:

// Arrange

var controller = = CreateDinnersControllerAs("SomeUser");

this is repeated twice (for both unit tests) on this page. Page 183 has it listed correctly in those unit tests.

(i've not checked the codeplex source code, btw).

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 9:23 PM by Ben Amada

Hi Scott.  It's very generous and noble of you to not accept payment from Wrox in return for making the PDF free.  I guess this means Scott, Rob and Phil took the money and ran?? :)

Thank you for the PDF!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 10:26 PM by Joe Chung

Great to hear that the Gu will be blogging more regularly again!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 10:52 PM by Minhajuddin

That is totally AWESOME! Man I love Microsoft, Scott, Thanks for making all this happen.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 11:10 PM by Danny

Scott,

In a word - Thanks

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 10, 2009 11:24 PM by HeartattacK

Great stuff. Any reason you chose the "retired" Linq to SQL as oppsed to EF? Not that it's important given the context...

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 12:39 AM by C.T.

How can i get the lastest code of the website NerdDinner.com ?

Thanks,

cttoy@hotmail.com

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 12:42 AM by shiju

Hi Scott,

Your commitment to the .Net community is AWESOME.  

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 12:59 AM by albertpascual

Congratulations on the book, a must buy!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 1:08 AM by Jack

Wow, another MVC material. Hope the RTM will release soon.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:03 AM by RichB

NerdDinner - impressive HTML (especially out of MS!). Semantic, SEO, clean. Fantastic.

My minor comments are:

1) IE7 compat mode. Yuck.

2) Massive JavaScript global namespace pollution

3) Could do with a @media print section in production.css to put back the H1 logo for printing (have a look at print preview).

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:22 AM by Tommy Holm Jakobsen

Thank you very much Scott. Very nice work and it is much appreciated!

Looking forward to read the book.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:29 AM by Marko

scott, you're the man!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:33 AM by gerald_jk

Thank you very much for that book.

It's fantastic that you give it away for free.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:47 AM by Имя

Да, неплохой туториал.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 5:07 AM by Anael

Haven't had time to look at it in details but i already appreciate the "philosophy" of sharing it with the community!!!

Thanks a lot!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 5:24 AM by ponnu

Thanks Scott, nice of you to make your chapter available free and before even the book is published.

I am sure you will be releasing MVC next week in MIX 2009.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 5:30 AM by Chosen Breed

Hi Scott! Thanks for the eBook Tutorial. I've not read it yet but I just want to say a big thank for what you are doing for the community. Keep it up!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 5:46 AM by JamesT

Great Work, how do you have time to do your "Exec" duties? while writing quality tech material , my only wrinkle is why you chose LINQ to SQL as your Data Access pattern, I expect all ASP\SL\WPF  communication from now on is to use LINQ to Entities for Data Access. ADO.NET  informed us last October that Entity framework is the tool of choice. This leaves me a bit confused as to why the "Chief Evangelist" is still using technology MS states we should move away from.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 6:28 AM by anas

Thanks for your effort and time.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 6:46 AM by Amgad Suliman

This is a very generous way to make deal with a book publisher. Thank you.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 8:12 AM by Andres Urena

Thank you very much...!!!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 8:41 AM by MOhanRao

Its a WOnderfull Book. Thanks Giving freely

Regards

MohanRao.D

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:08 AM by Arnaud

David, reste bien bien tranquille

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:13 AM by Jordan Marr

Alriiiiiiight!  You are now officially "The Man!"

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:13 AM by David Garcia

Thank you Scott! You are truly the King of Nerds :)  (and I mean that in the best way possible!)

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:24 AM by Rick Liddle

Thank you, Scott. As always, I'm impressed with your drive and efforts to get knowledge into our hands.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:29 AM by Muhammad Adnan

Why on book title page, everyone is showing teeth :D seems doing ad of some tooth paste or tooth brush or may be :D

Anyhow jokes apart... Thanks for such a great stuff man... God bless you

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:30 AM by Falak Shah

Thank you  very much for free book

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:32 AM by Doug

Great - thank you very much

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:54 AM by John Dunagan

This is awesome, Scott. Can't wait for MVC to go release.

My Group site needs serious design help - this came out just in time.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:00 AM by codetoglory

I never understand the need for putting pictures of authors on the books, specially when it gets crowded.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:01 AM by bfedotoff@hotmail.com

Hi Scott,

Many thanks for the tutorial. But I get an error when I try to open it (corrupted file, can't be repared). I tried to download it several times, but always the same error. FYI, I opened it on a french OS (don't know if that could help), with a french pdf reader.

Thanks,

Bernard (available on RD alias, too :-))

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:53 AM by Peter.O

Thanks, Scott. Thanks very much.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:54 AM by michael

Scott,

if you were starting a new project tomorrow, would you go with WebForms or MVC? If you had an existing WebForms application, would you start to migrate it to MVC?

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:58 AM by vinod

Thanks Scott for your excellent work.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 11:34 AM by Roland S

I don't normally get on board with new tech because it tends to blow around like the wind and be gone but this one makes sense. I have been working with MVC for the past three months and I'm liking it. Thanks to you and the other guys for filling in the gaps.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 11:47 AM by aswad32

hey scott thank's a lot for this free ebook, it will a really good resource for me for starting up my MVC adventures....

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 11:53 AM by pcazella

Scott,

Thank you very much for this end-to-end example, it has given me a few things to think about in my own MVC spike projects.

I do have one question regarding the ModelState error messages.  In your example you have the following code snippent in the controller.

foreach (var issue in dinner.GetRuleViolations()) {

  ModelState.AddModelError(issue.PropertyName, issue.ErrorMessage);

}

I've a VB guy so maybe this question has to do with it being language specific, but I have to call the ModelState.SetModelValue() method as well for each .AddModelError when using MVC RC1.  It was not required in previous versions, but I've read a few articles about the differnce and why it's now required.

I expected to see your code look like this:

foreach (var issue in dinner.GetRuleViolations()) {

  ModelState.AddModelError(issue.PropertyName, issue.ErrorMessage);

  ModelState.SetModelValue(issue.PropertyName, ValueProvider(issue.PropertyName));

}

So my question is, how come you don't have the call the SetModelValue method...but I do?

Phil

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 12:45 PM by Dave Hayden

Phil,

I believe SetModelValue has to do with databinding and in your case re-displaying the form values back on the form along with the errors. You don't need to call SetModelValue to display the errors on the form as the call to AddModelError will do that for you.

In the eBook you will see that the dinner is passed as the Model to the View as:

return View(dinner)

and in the Edit View the textboxes are displayed with the Model values:

Html.TextBox("Title", Model.Title)

which is doing the databinding. Hence, no need for SetModelValue.

There is no need for SetModelValue if you stick with the standard actions, forms, and defaultmodelbinder as presented in the eBook.

Hope this helps,

Dave

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 1:39 PM by FarDeeN

I need this eBook Tutorial, it may help me as i'm junior web developer.

Thnx

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 1:39 PM by Conor McCarthy

I've run into 2 problems on page 90.

I get an error because the GET and POST Create methods both have the same signature.

And another error because there is no AddRuleViolations method in my ModelState.

Am I using an old version of MVC or something?

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 2:02 PM by pcazella

@Dave

Thank you very much for the reply.  The view I'm returning the data to is not strongly typed as it contains a mixed bag of information.  So, while I am using the HTML helpers for the validation summary and text boxes, the lack of a specific "type" of page to bind to makes sense as to why it didn't work for me.

I feel better now. :)

-Phil

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 2:37 PM by Ray

I have a question on the section "Understanding IQuerable<T>", where I see the cool thing about IQuerable<T> that it won't execute the query against the DB till we iterate or ToList() on it, so we have a chance to chain/filter in the Controller's Index() method on the IQueryable<Dinner> returned from DinnerRepository.FindUpcomingDinners() method.

My question is who is taking care of the DB connection in this case?  Normally in my DAL I'd have code like this,

using (NerdDinnerDataContext db = new NerdDinnerDataContext())

{

  // access DB and get back stuff, then after using statement the connection is release back to pool or closed etc.

}

But here apparently the whole point is to defer execution, so if I do put using here then later up the tier in Index() when I do filtering like Skip() I see an exception telling me the DB connection is closed already.  So, I'm just wondering in the code presented in this section, is the DB connection released automatically for me after Index() method in the Controller by the DataContext?  Since there is no using or close() written out explicitly, I'd like to know when and how the DB connection is managed for me?

Thanks a lot guys!!

Ray.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 2:39 PM by rickj1

Where can I find XUnit extensions for mvc so I can use VS2008 standard edition

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 4:55 PM by Rodrigo Lobo

Hi Scott,

The recommended data access model is Linq to Sql or Entity Framework?

I got a bug when i was using Entity Framework on ASP .NET MVC Project...

How can i contact its team?

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 5:50 PM by Andrew

What a valuable resource.  Thank you so much for putting the time in to release something as detailed and comprehensive as this.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 6:10 PM by steve ciske

Excellent!  Thanks so much!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 6:58 PM by John

Hi Scott, quick question. Why was the "yield return" feature of C# used for the GetRuleViolations() method? Is there a particular reason this was chosen?

Thanks, John

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:14 PM by Chris Pietschmann

I am curious to find out why the book is being published by Wrox and not Microsoft Press; especially since I would imagine that Microsoft would want to promote ASP.NET MVC as much as possible.

Anyway, Thanks for giving this chapter out for Free. I look forward to the books release.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 9:37 PM by yousaid

This offers NOTHING, to a VB developer interested in learning MVC. It seems an assumption was made that only C# developers will buy this book which seems like a safe assumption, but then, as a chief evangelist for VB and C#, where is the VB version?

Is this book written for C# developers only?

Great tutorial for C#shapers, but not much for VB coders not interested in learning C#.

yousaid

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 10:41 PM by ColinW

Read through all 185 pages of the ebook tonight, excellent work!

I found a few (minor) issues while going through it:

• <title> tags are included in the top placeholder on page 92, they are redundant ( the placeholder is already in title tags )

• Countries is misspelled ‘counties’ on page 101

• ~Views should be ~/Views on page 111

• ‘LogonStatus’ partial view name should be ‘LogOnUserControl’ ( at least in RC2 ) on page 115

• We’ll BE using…., not We’ll by using…. on page 126

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 11, 2009 11:53 PM by Cody Skidmore

Scott,

Will the final book be sold as an eBook as well as a dead-tree edition?  I switched to all ebooks for their advantage and haven't turned back.

I'll buy a copy right now if I can get it in an eBook form.

Cody

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 12:11 AM by marafacs

Thanks alot Scott and specially for C# version of the tutorial :)

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 12:22 AM by vik20000in

wow greate news, First a chapter in book by you and then the news that you will be comming back to normal blogging very soon. Can wait to see more post from you ......

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 4:49 AM by Arjun

Thanks Scott!!!

As always hats off to you!!!:-)

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 7:56 AM by mcp111

I downloaded the source code and ran it but that only runs the tests. How do I see the website like the screenshots you have shown?

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 8:30 AM by Sam

Hello Scott,

I would like to ask a question regarding the DinnerRepository class. I like the fact that methods are separated from the rest of the Diner class' properties. However in the DinnerRepository class you create a new NerdDinnerDataContext object.

Would that not be a problem if there were objects to persist to the database, i.e I would you make sure that when you call the Save() method on DinnerRepository, it executes it the same transaction as the Save() method of another entity type.

Would it not be better to pass the DataContext object to the DinnerRepository class, and do so with all other entities, to make sure they all execute within the same transaction ?

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 8:31 AM by Marcel

Thanks for the book. I've downloaded ASP.Net MVC RC and I'll start playing with it :)

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 8:59 AM by Dileep

Great thanks for sharing

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 9:24 AM by cskidmore

Scott,

Will the final book sell as a PDF or only as a dead-tree edition?  If I can buy it as a eBook, I'll purchase it right now.

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 9:32 AM by mohamad ahmad

I may not be able to describe you as you deserve , but I can say that you are really a kind

and generous man ... I hope to see others dictate you in providing such Tutorial contributions for free.

Thanks very much.

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 9:46 AM by Guido van Santen

Thanks for offering this!

I'm currently using this for my graduation project at SyncForce.

Very interesting stuff!

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 9:52 AM by SergeyS

2004-2009: out-of-bound callbacks => Ajax => MVC  

www.theserverside.net/.../interview.tss

Great job, but, still ...

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 11:53 AM by Arvind Venugopal

Thanks for the great+free eBook Scott. I had the privilege of attending one of your Whidbey presentations at Milwaukee back in 2005, and you were awesome :) - Thanks again...

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 5:25 PM by Ricardo Martins

Great!!!!

More articles and books, best future developers!

Congratulations!

[]'s

Ricardo Martins

Brazil

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 6:22 PM by Quoo

Awesome that you will be back in the land of the living! Looking forward to your posts and wish you much success with your book.

Adios

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 12, 2009 8:29 PM by QFord

It's so kind of U!

A developer from CN

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 5:09 AM by rohanf4ever

This is great.. excellent.

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 7:02 AM by JeroenH

Scott, I just skimmed through the free book chapter and it's very useful stuff!

I came across one small issue: I just happened to implement paging for an app I'm working on, and so I read the part about paging support. I think there's a small bug in the code on page 119:

  upcomingDinners.Skip((page ?? 0) * pageSize).Take(pageSize)

When the page argument is anything but null or 0, you will get (page + 1). I think the code should read something like

  var pagesToSkip = (page ?? 1) - 1;

  upcomingDinners.Skip(pagesToSkip * pageSize).Take(pageSize)

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 10:30 AM by Peter.O

Hi Scott,

I just finished walking-through the book, end-to-end (except for the MAP API which I just skipped).

I think it's a unique 'chapter 1'. If you ask me, it's actually a Section 1. I am wondering if any of the other chapters discussed MVC localization ... or is there something you can point us to for how MVC handles localization?

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 11:38 AM by Chris Kinsman

So that is what you were working on at the Bellevue Starbucks so feverishly a couple of Saturdays ago...

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 1:22 PM by Volkan Uzun

Hi Scott,

thanx a lot for the book, great tutorial.

small thing: at page 89, the create should have formcollection parameter, eitherwise it is trying to override Create() get

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 1:39 PM by Peroth

Thank you very much!.....

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 1:44 PM by Peroth

Not able to download it because it is saying the file is damaged!.....

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 13, 2009 6:28 PM by Tom Lianza

Thanks for this fantastic chapter!  Just seeing how the Repository pattern cleaned up the model layer was worth the whole chapter for me.

A few comments:

- Let me guess... some sort of validation framework in the works for a future edition of MVC? :)  That pattern (the one you coded as the "RuleViolation" class) is generic and something everyone could use.

- In a future edition of LINQ to SQL I would *love* better support for disconnected entities.  Having to query an object before updating/deleting it is a waste, IMO.  We're all used to having our DB handle concurrency issues... it seems like this extra hoop is necessary in order to solve a problem we don't really have (or, at least, we're ok with having).

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 4:02 AM by Muhammad Zafar Alam

Thanks Scott!

you done excellent work.

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 6:21 AM by Evan

Great, great, great stuf!!!. Thanks.!!!

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 7:58 AM by Mario Abela

Great, Thanks for the free book

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 9:24 AM by DENYS ALVES

Tutorial practical and complete. Exclusiveness for MVC.

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 9:07 PM by Wu Zhou

thanks a lot! the chapter is very easy to follow, so far i'm half way through the sample project. since i use vb.net, i need to convert code from C#, but met with some problems, first is:

partial void OnValidate(ChangeAction action) {...} under Models>Dinner.cs. When i convert it to vb.net, firstly, it cannot recongnise ChangeAction type, where is it defined? secondly, an error reports: Partial methods must have empty method bodies. What to do with that?

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 14, 2009 10:19 PM by thanh

Another wonderful product. Thank you.

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 15, 2009 2:49 AM by Sanjay Singh

Excellent material. Thanks Scott for the great eBook - I am just amazed at how MVC can help to build great application and your book helped to get it in just few hours. It sets a trend on how to write books that can really help developers to understand the new technology quicker and get their hands dirty on the code. I am going to push MVC in my team and will look forward for the book release. Hope every chapter in the book covers detail step to master most of the aspect of MVC.

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 15, 2009 4:46 PM by Ranjit

Great tutorial...

Like your coding Style...going to follow that from now on!!

Thanks Scott.

Like your coding Style...

One small typo:

if (String.IsNullOrEmpty(Country))

yield return new RuleViolation("Country required", "Address");

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 15, 2009 5:55 PM by Yash

Great tutorial Scott!!!!

I have one question for you,

any particular reason why the MapRoute is an extensionMethod and not a static method in RouteCollection class..

Just wondering what is the thought behind doing this ...

If anyone can explain that will be good.

Thanks,

YP

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 12:53 AM by Anish Devasia

Amzing Work!!!

Thanks very much...

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 2:55 AM by Peter.O

Scott,

(am almost sure I've submitted this question before).

I'd like to know if you can point us to anything definitive on MVC Localization (seeing that your chapters does not touch on it. Or will it be in the second part of the book? Thanks.

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 8:46 AM by Farid

Thank you for the kind gift, Scott!

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 10:11 AM by Sanjay Singh

A great book. Thanks to Scott for providing the best material to start with on ASP.NET MVC. Looking forward to the release of the book.

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 11:26 AM by Varin

Facinated. What types of applications that MVC is mostly suitable for?

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 16, 2009 10:45 PM by Rick

Awesome chapter, you really cover a lot of ground and answered a lot of my wonderings about .NET MVC. Thanks for your generosity.

There may be a bug on page 150:

"You’ve probably heard of “focus” events that fire when a user clicks or tabs into a

textbox. The opposite is a “blur” event that fires when a user exits a textbox."

If the user clicks the "Save" button, while still in the address field, "blur" never gets called.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 17, 2009 4:15 AM by Marc Schlechter

Thanks for the book, I have a couple of questions though:

1. How should we deal with concurrency? Your NerdDinner sample has a 'last wins' scenario. Also, the whole GetDinner call before the SaveChanges completely defeats the purpose of having optimistic concurrency built into Linq2sql and EF.

2. What is the lifespan of a controller like the DinnerController? Is it per session, per application, per request? Maybe I missed it reading the book, but I would like to know more about the inner workings in order to use the MVC framework correctly.

Thanks!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 17, 2009 2:00 PM by vikrant

Hi Scott,

Wooooooooooow! got the free PDF version and it's really easy to follow. This Ebook is also an eye-opener  to LINQ programming. I really like the STEP-BY-STEP approach in this EBook

Thanks to Rob Conery, Scott Hanselman, Phil Haack,Scott Guthrie.

Hoping for more free EBooks from you Guys.

Regards,

Vikrant.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 17, 2009 6:54 PM by ramjee

Thanks you Scott

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 1:22 AM by Hemanth

Thanks you for always keeping us upto date

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 5:04 AM by vahid taslimi

thanks for the greate tutorial.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 10:31 AM by Simon

Scott,

I've been working through your tutorial and wanted to thank you for taking the time to write it with such great effort and detail. The few questions I've had along the way were mostly answered in context as I went along in the tutorial. It's terrific to see someone, who's progressed so well at Microsoft still have such a developer-oriented mind.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 10:53 AM by Ian warwick

That is a very generous offering, cheers Scott, I might have to organise a nerd dinner :)

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 11:03 AM by Jonathan

Scott,

Thanks for the tutorial and everything.

I have VS 2005, I guess I need VS 2008, for this. Will the free version of VS 2008 work?

Can I run the free version of VS 2008 on the same computer that has the full version of VS 2005?

Thanks,

Jonathan

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 4:55 PM by Eric

Awesome! Finally I am getting into MVC

"clicks download"

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 18, 2009 9:13 PM by Brian Boatright

all of these pingbacks make the comments section useless. Can you please delete them or do something to prevent them?

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 19, 2009 1:29 AM by Anthony Zang

Great.

Thanks for your sharing of the e-book.

Learned much about ASP.NET from your blog.

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 19, 2009 1:36 PM by Vish

Thanks Scott, this is very helpful.

I noticed one strange thing

routes.MapRoute(

"Default", // Route name

"{controller}/{action}/{id}", // URL w/ params

new { controller="Home", action="Index", id="" }

In my method I specified an argument other than id (eg: dinnerID) and I got an error:

The parameters dictionary contains a null entry for parameter 'dinnerID' of non-nullable type 'System.Int32' for method 'Void Details(Int32)' in 'NerdDinner.Controllers.DinnerController'. To make a parameter optional its type should be either a reference type or a Nullable type.

Parameter name: parameters

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 19, 2009 1:40 PM by Bestlinux

WOW!

EXCellent Book~

webhost4life.org

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 19, 2009 1:58 PM by MarkoPoikkimaki

Where's your post about asp.net mvc? You manage to post to pre-release asp.net mvc but not the actual release? I'm fed up with all this betashit... It's like when the product finnaly releases it's yeasterday's news.

# re: Free ASP.NET MVC eBook Tutorial

Thursday, March 19, 2009 3:54 PM by Rupak Ganguly

Hi Scott Gu,

  Great work again. One thing I noticed is that you mention that two controller tests Home and Account are created by default after the project is created. But, I see only the HomeController tests was created. Am I missing somethin? Anyone else notice that?

Keep up the good work guys. By the way, Scott Gu, great video on C9 regarding SL 3. Loved it.

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 20, 2009 8:10 AM by Ashish

Wow its very helpful. Awesome!!!

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 20, 2009 8:18 AM by Mike

We've really got to get away from the excessive use of the 'var' keyword...

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 20, 2009 1:15 PM by Andrew

Hi Scott,

Not sure the correct place to report errors in the NerdDinner document.  So I'll just mention the small oversight I have noticed here.

On Page 6 ...

CRUD (Create, Update, Delete) should read CRUD (Create, Read, Update, Delete).

Hope this is of use.

Andrew

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 23, 2009 1:30 AM by fahad

is the link corrupt ? is not opening on firefox and IE ....can this link be reshared ...thanks .

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 23, 2009 11:59 AM by Punit

Thanks Scott. Valuable knowledge for free is every 'basement' developers dream! :)

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 23, 2009 9:08 PM by Ming Zhu

Thank you Scott. I will order this book when it is out.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 24, 2009 7:38 AM by arunmanglick

Thanks Scott. Very excited to see the complete book as even the first chapter covers a lot of depth.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 24, 2009 4:32 PM by Joe

Woot, MVC and a free simple walk thru. Good choice going with WROX. Now that you and the other smart ones are done with MVC can you go help the Entity framework team... I need a better DAL and so far nhibernate is the best.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 25, 2009 12:24 PM by Alex Cao

Thanks Scott. The book is useful to study ASP.NET MVC.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 25, 2009 1:42 PM by gustavo

Im trying to downloading but it seems its not complete , it says when it seems to be downloaded the whole thing ::the file is damaged, i tried three browsers so far

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, March 25, 2009 6:05 PM by Mitoman

thanks scott,

Question, will c# 4.0 or later version of Asp.net get Viewdata form of temporary data like MVC does?  Viewdata seems to be a great way of getting rid of querystring and still be able to pass on data without session.

# re: Free ASP.NET MVC eBook Tutorial

Friday, March 27, 2009 1:12 PM by Nico Nel

Thanks for your contribution by writing this chapter for free, resulting in us getting hold of it for free (I'm definitely buying the book as soon it comes out)

However I noticed several errors in the book.  Do you have a place where readers can report such errors?

Being a MVC noob, I spend some time figuring out what the heck "I" did wrong, just to find that the working sample code is a have the errors corrected.

Thanks again mate!  I've been "away" from .net for 2 years (doing PHP) and so far most of my "catching up" was done using your blog.  Fantastic job, really.

# re: Free ASP.NET MVC eBook Tutorial

Saturday, March 28, 2009 5:01 AM by Jatinder Singh

Your blog is excellent with upto date information.

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 29, 2009 1:20 AM by Costas

It would be nice if someone from MS could write a book regarding the Oxite project

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 29, 2009 2:05 PM by lost

Thanks for your great book.

I follow you step by step but can't register new user .

sql2000 return the error code 29 .

Can't use sql 2000 ?

# re: Free ASP.NET MVC eBook Tutorial

Sunday, March 29, 2009 10:53 PM by nirmshah_in

Thanks Scott....

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 30, 2009 9:35 AM by Terek Awan - Florida Asp.Net developer

Will this book be published in color?

Thanks,

Terek

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 30, 2009 10:40 AM by Rajeev

Scott,

Great stuff!

You have taken the simple approach to developing the website and enhanced it step by step which makes it a nice read. 10 out 10 from me.

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 30, 2009 8:24 PM by Long Giang

Great, I am so looking forward to know more ASP.NET MVC

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 30, 2009 9:58 PM by bob

I'd like to know is the mvc 1.0 release or in the preview? And who are using the asp.net MVC ?Thanks!

# re: Free ASP.NET MVC eBook Tutorial

Monday, March 30, 2009 11:28 PM by entlib

Thanks Scott.

We're translating this free chapter into Chinese. Please go to there if you're interested.

blog.entlib.com/.../asp.net-mvc-1.0nerddinner-part-1.aspx

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 31, 2009 12:06 AM by Eric Swann

Thanks Scott, this tutorial has been a huge help to me!

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 31, 2009 3:56 AM by stgaup

Thanks Scott. Nice walkthrough.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 31, 2009 10:11 AM by eralper

Thanks Scott,

That's very nice. A complete chapter that is guiding a full ASP.NET MVC application.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 31, 2009 2:32 PM by SChouinard

Hi Scott,

thanks for the tutorial. The pagination section helped me a lot in my little home application. One improvement you could do to it is extending the IQueryable<T> to include a method AsPaginated(int pageNo, int pageSize) that would return the paginated list.

bravo for your nice work doing this tutorial

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, March 31, 2009 7:27 PM by peony

great info! thanks.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 1, 2009 12:42 AM by Sunil

Thanks for sharing, its really good :-)

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 1, 2009 1:46 AM by codemeit

Thanks for your great articles and the well-done contribution to the community.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 1, 2009 5:26 AM by elevator

Thanks Scott,That's very nice.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 1, 2009 6:40 PM by Elena Malnati

Thank you from Italy!

# re: Free ASP.NET MVC eBook Tutorial

Thursday, April 2, 2009 3:50 PM by BENITO NAVARRO MARTINEZ

Excelent tutorial! We need more of this.

# re: Free ASP.NET MVC eBook Tutorial

Friday, April 3, 2009 7:37 AM by suman.biswas

Great article, this helps us. And your African safari is also very nice. :)

# re: Free ASP.NET MVC eBook Tutorial

Friday, April 3, 2009 8:50 AM by Rai Wills

And if you get out on safari you may enjoy Wendo Genet, Ethiopia.

But I digress.. thanks for the gift- more than just a marketing idea.

# re: Free ASP.NET MVC eBook Tutorial

Friday, April 3, 2009 10:40 PM by Jeremy

Under "Dependency Injection" on Pg.181 I was surprised not to see Microsoft's own offering (Unity) listed.  

# re: Free ASP.NET MVC eBook Tutorial

Sunday, April 5, 2009 9:37 PM by Caleb Cohoon

This is very cool! Thanks for writing this.

# re: Free ASP.NET MVC eBook Tutorial

Monday, April 6, 2009 12:25 AM by Free ebooks

This is a very useful post. thank you !

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 8, 2009 10:42 AM by César Intriago

Cool!!, I just downloaded the tutorial, no Halo3 this weekend for me.

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 8, 2009 1:52 PM by K.Kanagasubramanian

You are always sharing your knowledge stuff, great. I am really excited by seeing your knowledge. I am also so interested to learn and share my knowledge. I am so far using MVC for the last 2 years without using this framework. But after using it I feel really it is so simple to use, and reduces the entire development time.

Thanks Scott,

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 8, 2009 5:34 PM by Asif Mushtaq

Fantastic! Thanks.

# re: Free ASP.NET MVC eBook Tutorial

Thursday, April 9, 2009 2:11 PM by Steve S

The first 130 pages of the tutorial were very good. The section on mapping, beginning on page 147 starts to get shaky. For me the tutorial does not produce a map; it compiles fine.

The download code does work as the tutorial shows. I've gone through line by line can't find any errors. I've swapped out the tutorial code with working download code and still no maps. I do notice that the download code is using 1.26 version of jQuery where my tutorial project is using 1.32, other than that I can see no difference in the two code bases. single stepping through the code is the same for both the download and the tutorial; download produces map, tutorial doesn't.

Hmmm!

# re: Free ASP.NET MVC eBook Tutorial

Wednesday, April 15, 2009 3:28 PM by pankaj11

I am so impressed with the material. All I could say to myself "wow", what a material. I want to write the appliation so clean such as this one, but many times delivery challenges makes us go to old school coding.

Great Stuff!

# re: Free ASP.NET MVC eBook Tutorial

Thursday, April 30, 2009 10:40 AM by amenyo

greta ework but how do i get the vb version?

# re: Free ASP.NET MVC eBook Tutorial

Friday, May 1, 2009 4:27 AM by Richie Ryan R Reyes

Thanks! I'm having a hard time learning from msdn library, due to some missing component(s). (model)

# re: Free ASP.NET MVC eBook Tutorial

Friday, May 1, 2009 5:22 PM by Kola Owolabi

Scott, you are one of my greatest heroes. Thanks a million. Great job *****

# re: Free ASP.NET MVC eBook Tutorial

Monday, May 4, 2009 2:15 AM by ace

Well thanks for being open about your product author and allowing us to read it in ebook form. I guarantee many people will buy the actual book after reading some of the ebook. As much as we all hate reading ebooks we also all hate buying a tech book and hating it and wasting 30+ dollars. No one prefers ebooks over hard copy when it comes to reference books although it is nice to have the ebook handy sometimes.

# re: Free ASP.NET MVC eBook Tutorial

Tuesday, May 5, 2009 10:03 PM by Duke

i have been leaning alot from your blog for about a year now and it cool to see the cool features microsoft and .net team has been pulling off. I have one more quetion if someone could make a a book that was to use the book to make a similar application like the google friend connect i think that will be a good idea or at least a demo other than that i just started a project like googles' friend connect and i need help