Site Meter

Pro ASP.NET MVC 2 Framework

imageThis week Apress is sending the second edition of my ASP.NET MVC book to the printers. Hopefully this means you can get your hands on physical copies by the end of this month.

The first edition went deep into the details of the MVC Framework, providing both tutorials and reference material. Judging by sales and review scores, it was a success. The second edition:

  • … is thoroughly updated for ASP.NET MVC 2. It explains all the new features, including templating, metadata, validation, asynchronous controllers, areas, HTTP method overloading, strongly-typed input helpers, default parameters, etc., and many are demonstrated in the various tutorials.
  • … is updated to account for .NET 4 and Visual Studio 2010. Even though .NET 4/C# 4 is the preferred technology throughout the book, all the documentation and code accounts for readers using .NET 3.5 as well.
  • … is updated to reflect more recent patterns and best practices. For example, discussions of automated testing apply ideas from Behaviour Driven Development (BDD) where relevant, and tutorials and descriptions now consistently distinguish between view models and domain models.
  • … is updated in light of reader feedback from the first edition. Certain explanations and terminology are overhauled, and the tutorials make use of more effective third-party libraries (e.g., Ninject for Dependency Injection).

This blog post is partly intended to build awareness of the new book, and is partly intended to deal with some of the questions I regularly get by email. So, here are some questions that people frequently ask:

Is this a new book, or an update?

It’s an update of the first edition. The following diagram should clarify what proportions of the book are new, dramatically changed, or just refreshed:


Where and exactly when can I get it?

I don’t know the exact date when it will ship; this depends on physical production and distribution schedules that are beyond my knowledge.

  • For printed copies, your best bet is to pre-order with Amazon. Hopefully these will ship around the end of June, but I can’t guarantee it.
  • For the eBook version, keep checking the Apress web site.

There’ll probably be a Kindle version in due course, too.

If I already have the first edition, should I buy the second edition?

If you use ASP.NET MVC regularly – especially if plan to use the new MVC 2 features but haven’t yet learned about them in depth – you may well get a lot out of reading the new edition and seeing what’s the same and what’s new. You may also have colleagues who need a deeper knowledge of the whole MVC Framework, including both v1 and v2 features.

However if you don’t use ASP.NET MVC much and don’t intend to migrate your development to v2, perhaps there isn’t such a strong case for buying an update of a book you already own.

Some readers have asked if they can get a sort of “upgrade” edition which contains only the new material. That wouldn’t really make sense for this book, as the new concepts and practices are applied throughout. I don’t present “old” material followed by “new” material – the whole manuscript is updated as a single coherent guide to ASP.NET MVC 2 from the beginning as I believe this gives the clearest understanding.

What new and updated in the second edition?

There are far too many updates and enhancements in the new edition to describe them all. Here’s a brief outline of the table of contents and roughly how each chapter has changed.

Chapter 1: What’s the Big Idea?

Updated to account for ASP.NET 4, including improvements to WebForms and how this impacts the comparison between the two frameworks. Gives an overview of what’s new in ASP.NET MVC 2. Changed the discussion general software development practices to account for more recent trends.

Chapter 2: Your First ASP.NET MVC Application

Tutorial now accounts for your choice of Visual Studio 2008 or Visual Studio 2010. Uses new ASP.NET MVC 2 features, including empty project template, automatic HTML encoding, and Data Annotations validation. Streamlined the flow of the tutorial to improve readability.

Chapter 3: Prerequisites

Describes newer architectural patterns including MVVM. Discussion of automated testing expanded to cover integration testing as well as unit testing, and demonstrates Cucumber-style BDD testing and explains the tradeoffs between this and traditional unit TDD. Various updates to terminology and explanations.

Chapter 4, 5, 6: SportsStore tutorial

Now accounts for your choice of Visual Studio 2008 or Visual Studio 2010. Improved the code: better project structure, uses Ninject instead of Castle Windsor for DI, has better unit test naming (BDD-style) with a clearer description of the limitations of such testing. Applies the viewmodel pattern and related terminology more consistently.

Adapted the tutorial to benefit from MVC 2 features including optional parameters, metadata, scaffolding, client-side validation, automatic (de)serialization, etc. Some parts of the tutorial now go in a different order to make it easier to follow.

Chapter 7: Overview of ASP.NET MVC Projects

Updated to account for ASP.NET MVC 2’s two project template options (empty and non-empty), and for changes in the core ASP.NET 4 platform regarding configuration and deployment.

Chapter 8: URLs and Routing

Now covers areas – reasons for using them, setting them up, their impact on routing, how to avoid common problems, how to unit test their routing configuration. Explains how .NET 4 changes where the routing code lives and how ASP.NET MVC 2 deals with controller namespaces. Many smaller changes.

Chapter 9: Controllers

The 1st edition’s “Controllers” chapter is now split in two – this first chapter now covers introductory topics – receiving input data with parameter binding etc, producing output with action results etc., unit testing.

Has many changes to account for ASP.NET MVC 2, such as its enhancements to TempData. Also describes .NET 4 features – using optional parameters (and how these differ from ASP.NET MVC 2’s parameter defaults), using “dynamic” as a model type, etc. Expands the coverage of unit testing, demonstrating 5 ways to make mocking controllers easier.

Chapter 10: Controller Extensibility

The 1st edition’s “Controllers” chapter is now split in two – this second chapter now covers more advanced topics – custom filters, method selectors, controller factories, etc.

Updated to reflect changes in the ASP.NET MVC 2 request-processing pipeline, new built-in filters, HTTP Meth
od Overriding, etc. Adds (a lot of) coverage of asynchronous controllers – not just how to use them, but how to measure their impact and avoid common misconfiguration problems.

Chapter 11: Views

Goes into detail about how automatic HTML encoding works. Coverage of HTML helper methods expanded for ASP.NET MVC 2 (there’s now over 50 helpers, and that’s before you even start counting all their different overloads). Explains new ways to render partials.

Chapter 12: Models

Most of this massive chapter is totally new, and goes into great detail about metadata, templating, and validation. Covers how the built-in templates work, creating custom ones, using HTML field prefixes, implementing custom metadata sources, consuming metadata, custom validation providers, custom client-side validation, doing all this inside a multi-tier architecture, etc.

The explanation of model binding and value providers is significantly updated to account for the new architecture in ASP.NET MVC 2.

Chapter 13: User Interface Techniques

This new chapter inherits UI-related material from various parts of the 1st edition book, including wizards, CAPTCHAs, child actions, master pages, open-source view engines, custom view engines. All updated to match ASP.NET MVC 2, of course.

Chapter 14: Ajax and Client Scripting

Updated various aspects of the code and explanations to account for new framework features, and to make things work with more recent versions of IE. Expanded the coverage of JSON data services, including security issues and ways to handle cross-domain requests. Some recommendations are updated to account for client-side performance considerations(browser’s rendering pipeline, CDNs, etc).

Chapter 15: Security and Vulnerability

Mostly the same as in the first edition. Shows an alternative tamper-proofing mechanism using MVC 2 code, plus describes JavaScript string encoding and its relation to script injection. Various code changes to fit in with ASP.NET MVC 2.

Chapter 16: Deployment

Radically restructured chapter – now all organized with step-by-step guides and checklists for each targeted IIS version, so now you only have to read the material relevant to you. Covers new deployment options, including combinations of .NET 3.5 SP1, .NET 4, Server 2003, Server 2008, Server 2008 R2, Server 2008 R2 Core, shared hosting, classic/integrated pipeline mode, etc. Accounts for many changes to these deployment environments since the 1st edition, including IIS 7.5-specific issues

Clearer explanations of various IIS request-processing mechanisms. A new section describes VS2010’s improved publishing and packaging mechanisms, config file transforms, etc.

Chapter 17: Using ASP.NET Core Platform Features

Mostly the same as in the first edition. Updated to account for ASP.NET MVC 2, IIS 7.5, with tweaks to code and explanations. Information about configuration APIs moved from Deployment chapter into this chapter.

Chapter 18: Migrating Existing Applications to ASP.NET MVC 2.0

Various updates relating to .NET 4 / VS2010 / ASP.NET MVC 2, including how to upgrade Web Forms applications to support MVC, using routing when combining MVC with Web Forms (both on .NET 3.5 and .NET 4), ways you can use Web Forms server controls with postbacks in MVC 2, should you wish to.

New section describes upgrading from ASP.NET MVC 1 – using automated tooling, doing it manually, a post-upgrade checklist, workarounds for potential problems.

OK, enough details

Of course, there are other ASP.NET MVC 2 books in the pipeline too. No doubt you’ll enjoy and benefit from any of them.

88 Responses to Pro ASP.NET MVC 2 Framework

  1. First edition was fantastic, really looking forward to this!

  2. Well done, a lot of hard effort.

    Ordered my copy already ;-)

  3. Gregor Suttie

    Awesome – will get my copy ordered, first book was great!

  4. Already pre-ordered, based on reviews of the previous edition. Can’t wait for it to arrive!

  5. Mister Matt

    Thanks for the graph/piechart on what’s old, what’s new, and what’s been updated. I’ve already pre-ordered my copy from and looking forward to it.

    Also, wanted to ask about MS’s Unity vs. Ninject and other DI/IoC frameworks.

    Do you have any experience w/ Unity? Why did you pick Ninject? (and switch away from Castle Windsor?) Just curious, as I’m still learning about DI.


  6. Tom

    You know, this is the type of post every author should make. I have the first edition and honestly wasn’t planning on buying the second only because I felt I could get most of what I needed about changes to the MVC framework online. But after reading this I pre-ordered the new book from Amazon right away.

  7. Paul

    I pre-ordered this book about 3 months ago and appreciate the update! Do you cover best practices in this book for separating out logic (IoC, Routing, etc…) from the Global.asax? This is something I have struggled to find good information on and was hoping to find good solutions in this book.

    I am with Mister Matt, why Ninject 2 and not something like Structuremap?

  8. GazNewt

    Great stuff, been waiting for this book, and the new EF4 book too

  9. Michael Walsh

    I absolutely loved the first edition. I have never come across a book as coherent and well written and focusing on *real* scenarios.

    I preordered V2 a month ago and am really looking forward to it arriving.

    Thanks for getting me hooked on testing too!

  10. Congrats!!!

    Will now xVal get a time slice? :D

  11. Thanks for this post. I wasn’t aware there were going to be so many changes, I’ll definitely be pre-ordering this now. The first edition was one of the best books I ever read.

    In regards to the IoC container choice… I use StructureMap myself, but I had no problems substituting Castle Windsor with it in the first book’s example. I went through the SportsStore chapters as normal and then went back and replaced it with StructureMap in a few minutes.

    The important thing is that you clearly showed how to use an IoC container in MVC and that made it easy for me to use whichever one I wanted.

  12. As Dan Martin says, first edition was one of the best books on programming topics I ever read, hope I’ll enjoy this version as much! Maybe I’ll actually really understand Model Binding this time round.
    See you at CodeGarden in Copenhagen!

  13. Been Waiting for this one. Do you have a say to publisher if this can be published in INDIA as well ? They didn’t publish the first version and I had to get it imported through Amazon (takes over a month to arrive!).

    I am hoping this book publishes in India else I will have to order through amazon again and patiently wait for over a month :(

  14. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #620

  15. Jon

    Good work, I loved the first book, I’m pre-ordering

  16. Phillip Jones

    Loved the first edition – one of my favorites. Great depth and perspective and very well written. Have had the second edition pre-ordered on Amazon from day 1 – looking forward to it.

  17. Alexander DiMauro

    Pre-ordered back in March. First edition was the best MVC book out there! I always regretted only getting the eBook. This time around, I’m getting the physical copy. This is THE book to carry around for MVC. Looking forward to it…thanks!

  18. Deathtospam

    Was this book written — or at least double-checked against — the final release of both .NET 4.0 and the MVC 2.0 specs? Or is it based on a beta version of either?

  19. Can’t wait! In fact, I am getting rather impatient with APress, why can’t they get the PDF out right…this…minute?!

  20. Ivan

    Can’t wait for the (e)Book, first one was really good! Read the whole thing (don’t usually do that) and have going back to it as a reference.

  21. Pre-ordered today, looking forward to the read ;) .

  22. BillB

    Agreed – Ed 1. was the best programming book I’ve read and I’ll be ordering ed 2. I also have the Preview book that APress put out before ed. 1 – the book that made me excited about coding for the web with MS tools again. My Sanderson collection will be complete. Great work, Steve!

  23. Hi there:
    just wondering, is the rough cut supposed to be available through Safari? I was looking for it and I couldnt find it


  24. Aleq

    Absolutely loved 1st edition and just purchased 2nd edition ebook from Apress. By the way FLEPSTUDIOLS code gets you 50% off ;) Looking forward to reading it! Steve, you rock!

    I am curious why you decided to switch from Castle to Ninject? I use S#arp Architecture and they did the opposite, switched from Ninject to Castle Windsor.

  25. Christopher Edwards

    Have almost finished viewing your excellent series of screencasts on and was moved to buy your MVC 2 book.

    I take it there is no way to pre-order this in the UK?? The link provided is to Amazon US….

  26. Tom Lueers

    Great Book!
    just bought the ebook. What about the source


  27. Hi, thanks for the great post but your website doesn’t seem to load properly in Safari, any suggestions? Thanks :)

  28. Bill Williams

    First edition was the best book on MVC (and software development in general). I look forward to this book and any planned future books.

  29. Steve

    Thanks everyone for your kind comments!

    Mister Matt – I went with Ninject just because it’s really easy to set up and demonstrates principles that would apply to any DI container. I switched away from Castle because its tendency towards XML config didn’t turn out to be useful and readers wouldn’t find it as obvious how to install/set up (the biggest cause of errata reports from the 1st edition was people saying they weren’t sure what parts of Castle to install, and the installers changed dramatically after the book was published).

    Paul – RE: StructureMap – see above. RE: Global.asax.cs – I haven’t specifically discussed factoring code out of this, but if you wish you can move your routing config (etc) to a separate class and invoke it from Global.asax.cs

    Andrei – I’m open to enhancing xVal if there’s a need, but ASP.NET MVC 2 covers most of that functionality now. If there’s anything specific you’d like to add to xVal, please submit a patch :)

    Parag – Sorry, I’ve no idea what Apress plan regarding distribution to India. I would guess they will continue with whatever arrangements they already have in place.

    Deathtospam – Yes, the whole things was checked against VS2010 RTM / .NET 4 RTM / ASP.NET MVC 2 RTM.

    Aleq – See above for comments about Ninject

    Christopher Edwards – You can preorder from It’s in stock now at Amazon US, but Amazon UK lags behind slightly. I’m sure they’ll have it in stock too soon.

    Tom Lueers – I’ve submitted the source to Apress so they should put it on their website very soon. If you’re really keen to get it now, please email me and I’ll send it to you directly.

    Sina – Really? I’ve just checked it on Safari for Windows and for iPhone and it looked perfect on both. What version of Safari are you using?

  30. Steve, the V1 book is the best programming book I have read. Thank you.

    Do you use Linq to SQL or Entity Framework 4.0 in the V2 book?

  31. Diane

    It would have been great to see Razor view engine covered in the book

  32. Diane – check the dates :)

    Razor isn’t even available yet and was just announced a day or two ago!

    It shouldn’t be a big leap to think in terms of Razor when looking at the default view engine pages.

  33. Just ordered my copy – thanks Steve for your great work on MVC technology

  34. Kevin

    Code download from Apress doesn’t work (corrupt zip file?)… I’m waiting on my book from Amazon and wanted to see the Ninject implementation. Can someone get this fixed??

  35. Steve

    Kevin, I just checked the code download from and it seemed to work fine. Can you email me with details of how it’s not working for you? Thanks.

  36. Pre-ordered 3 copies for my co-workers. They just arrived from Amazon now. Woohoo!

  37. I owe my job to the v1 book. I landed my current role after being one of the only dev’s in the area that could do MVC. I’ve just received V2 and I’m impressed with the new content some of it’s old hat but I like the new approach to viewmodels and using the ninject lib for IoC. Steve has a great way of making complex topics simple. looking forward to working my way through the book again.

    Thank you so much for this book Steve keep up the good work.

    One question why nothing on mvccontrib (only up to the sports store) but not seen anything on that yet. It saves me a lot of time when doing work especially the test helpers.. Would have been nice to see some stuff with it..

  38. Jon Jenkins

    I’ve enjoyed your postings on variable-length lists in MVC. I may try Knockout next. I saw the review of your book from Scott G. I already knew you were legit after the many articles I’ve read on your site, but that review nudged me to get your book. Thanks for all the advice… it’s helped me a ton!

  39. Maxim Filimonov

    Dear Steven,
    I’ve just purchased your book “Pro ASP.NET MVC 2 Framework” and I’ve read about 200 pages. Thank you a lot for the book Steven it’s one of the best technical books I’ve read in last 5 years. Without trying to create some stupid “books only apps” you create really close to production solutions in a way that is easy to follow and understand.
    I hope that you will write some books one other topics also especially about testing because I have a feeling that half of a chapter about testing in this book is not really enough for you to express all your thinking on the topic :)
    Looking forward for your next books.

  40. Nguyen Ngoc Tri

    Dear Steven,

    I have your MVC 1 book and just order MVC 2 book. One thing I wonder is in sportstore application you use custome model binding to create the Cart and store it in session object, is there anywhere you remove it from the session object again?

    By the way thank you very much, grat book, can’t way for the second to arrive.

  41. Steve S

    The MVC1 book was great, if it was an 8.5 the new MVC2 version is at least a 9.75. Way to go Steve.

    I was curious about the switch from Castle Windsor to Ninject, glad to see the answer to that above.

    Not sure if it was to simplify things for the book, but I thought it was better to keep the Action methods lean by placing more of the code with LINQ into the model?

    It would be nice to see a related blog post focusing on architecture and the model in MVC from a real world project/approach.

    Now I have to get back to the book.

  42. Dear sir, i really like this book very much. “Pro ASP.NET MVC 2 Framework”. I feel adventure in reading this book, it dont makes your bore at all. but may i know when the 3rd edition will come as MS has released MVC 3.

  43. Steve

    Hi Faisal

    It’s very early days for ASP.NET MVC 3 right now – they’ve just provided the first public preview, but this is a long way from a final release. Anyone developing a production ASP.NET MVC application is likely to stick with ASP.NET MVC 2 for a long time yet! I don’t yet have any plans for if or when I’d write about MVC v3 :)

  44. Peter

    Just to ditto a lot of the other comments – had the 1st edition – fantastic – really got me into the whole MVC/IoC stuff. The 2nd edition arrived recently and can’t wait for read about some of the newer stuff in your concise easy to understand style even though have been using MVC2 on my current project since I started on it.

  45. Cindy


    I have access to just Visual Web Developer 2010 EXPRESS — will that be sufficient to work through the book’s samples, tutorial, etc.? Is there anything presented in the book that I will NOT be able to experiment with in VWD2010 Express?


  46. Fernando

    Hi Steve,
    This is really a fantastic book, congratulations.
    As I’m reading it I’m trying to develop the SportsStore app and I hvae a problem.
    On page 110 (Creating a custom controller factory) you wrote:

    private IKernel kernel = new StandardKernel(new SportsStoreServices());
    but there is not such a class SportsStoreServices, I’ve read the chapter several times and I can’t find any reference to this.
    Something I’ve missed? Please help.


  47. MetaSam


    The SportsStoreServices is a private class inside the NinjectControllerFactory, if you didn’t find this out by yourself!

  48. Fernando

    Thank you MetaSam, the truth is that I didn’t find out by myself… :-(
    I don’t know how many times I read this chapter without noticing this.
    Thank’s a lot.


  49. Steve

    Cindy – as I understand, you can develop ASP.NET MVC 2 applications using VWD 2010. However, I’ve found that so few developers try to do this that it wasn’t worth the cost to produce a full set of VWD instructions for all the tutorials. I hope you’ll be successful using VWD but I don’t know exactly how it might differ from Visual Studio or how you’ll need to adapt the tutorials in the book.

    Fernando – sorry for the slow response.

    MetaSam – thanks for answering!

  50. trailblazer

    Thanks Steve for a wonderful book. The chapter 3 (Prerequisites) is fantastic.

  51. Some errata for you on the 2nd edition, page 36. “if (ModelState.IsValid)” should be (I think) “if (ViewData.ModelState.IsValid)”.

  52. Should have prefaced that with a “I’m really loving this book so far.”. On to chapter 4. :-)

  53. Steve

    Hi Keith – glad you’re enjoying the book. Actually, “ModelState.IsValid” is correct, and “ViewData.ModelState.IsValid” will also work.

  54. Ranjit

    Thank you soo much for getting this book out and making us understand about MVC, separation of concerns and DI.
    I have one question, I really appreciate some comments or insights on it.
    In your SQLRepository classes you are Hyderating the Entities with DataContext(connectionstring).GetTable. In case if we don’t want to get the whole table and get a partial set of columns,records how do we do it? How can I attribute the repository with a stored_proc instead of [Table]?

    Thank you for your guidance.

  55. Roy Martin

    Great book Steve!

    I’ve been working my way through chapters 4 and 5 and have noticed a couple of things with the Sportsstore app’s navigation:
    1. Once the category links were implemented (p146) they didn’t work for me, as the resultant link included a number of spaces at the end (%20) e.g. /Chess%20%20%20%20… I fixed it by adding a .Trim() to categoryName when added to navLinks.
    2. Again, once the menu system is implemented the second and third pages don’t seem to work when no category is selected, the links output with, for example, List?Page=2&category=. Sure I’ve missed something, maybe in the routing, but I can’t find it.

    Thanks again for a great book.

  56. rizzy

    I’m only on chapter 2 of your new book, and I couldn’t help but ask: should I be doing validation on Model, ViewModel or both? My actual Domain Model is a separate project which contains business logic as well as data access. I use viewmodels to create specific models for my controllers/views.

  57. Great book Steven!

    This is my first venture into ASP.NET MVC, and your book has really got me on the right track from the start! Perfect!

    I know the book isn’t about Ninject, but the only thing I’m missing so far (half-way through), is a clearer picture of how to use Ninject in other parts of the solution. If I need to access a repository from a business object, it would be nice to know where to get it from, without having to instantiate a particular implementation of the interface.

    But, all in all, a really good book!

  58. Andreas

    Dear Steve,

    I got a question regarding the section Model-View-View Model on page 50:

    Twice you mention the WCF/Silverlight binding feature. Is it really about WCF or did you mean WPF?

  59. Steve,

    It isnt often that I find a technical book to be “riveting”. I usually end up glossing it over and using it for reference only. However, with this book I actually have felt compelled to read, follow along and learn the material. I would even say that your prerequisites chapter is probably one of the best C# language tutorials I have ever read. I have been using IOC and DI at my day job and while I felt like I understood these concepts for the most part, I “get” it after reading your book. Well done, and thanks!

  60. Hi Steve,

    Loving the book so far! At the end of chapter 5 (P177-P178), there’s an exercise for the reader to complete. Is there any chance of getting the finished code in the project available for download? The official download doesn’t come with this code and I’m not sure how to complete all the steps properly!


  61. Yuri

    Hello, Steve.

    When I write
    “return View(_productsRepository.Products
    .Skip((page – 1) * pageSize)
    in my ProductContorller, it’s an error:
    “The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.”

    I found the error appears after Skip(). And if I put Skip().Take() after ToList() then there is no error in debugging but error appears in NUnit.

    When I put a breakpoint and watch in current state of my IQueryable I see there are no Items and there is something like SQL query. What can I do to solve the problem and have Skip().Take().ToList() running right?

    Sorry for my English – I’m Russian.

  62. dave choi

    Hello I’ve purchased your book and am going through it now. I am having one issue thought with the css. Its probably something that I’m doing wrong, but starting on bottom of page 145 you give some css to style the links for menu items. Well when I copy and paste the css into my site.css file it never shows up on the page. I’ve tried hitting f12 and viewing the css on each html item, but there’s actually no css from the A anchor showing in the page code. Everything compiles and loads properly I just don’t see your nice styling (I just get plain text with the body’s font style)

  63. dave choi

    Sorry it was my browser cache. Cleared it and now I’m good. Great book by the way!

  64. Winson Kwok

    I’ve been reading this book up to Chapter 8 which is about routing configuration. If you go through the SportsStore tutorial step by step, you will learn alot about MVC 2. However, MVC 3 RC2 is available now, I wish this book will update to MVC 3 soon as there is lot of enhancements, such as Razor Render Engine, Web Matrix …, in MVC 3! My recommendation to learn MVC framework, no matter it is Microsoft MVC or Ruby on Rails, is to learn Design Pattern first. MVC sounds more reasonable from Design Pattern perspective.

  65. RobG

    Hi Steve,

    Wonderful book! Chapter 5 ends with an exercise that’s been interesting to work on. Would you mind providing your thoughts on the best approach(s)?


  66. DaveH

    Hi there,

    I have checked my code about 10 times, and I have it entered just as in chapter 4. But, I keep getting this error in List.aspx. . .

    foreach statement cannot operate on variables of type ‘SportsStore.Domain.Entities.Product’ because ‘SportsStore.Domain.Entities.Product’ does not contain a public definition for ‘GetEnumerator’

    What am I missing?

  67. KevO

    Having real problems with the Direct Injection stuff on page 107. After I implement it, I keep getting an Object reference not set to an instance of an object error on this code:

    public override void Load()

    I have the constructor etc set up in SqlProductRepository.

  68. Martin

    Will there be a “Pro ASP.NET MVC 3″ book? And if so, any idea when that might be?

    BTW: i really enjoyed reading the first 2 editions.

  69. Vishnu


    I see the book has used LINQ2SQL for DB interactions…is it a good idea to use for applications in MVC architecture and having about millions of records to interact and transact ?? In simple terms, is LINQ2SQL good for huge data transactions ??? EntityFramework 4.0 / ADO.NET ???

  70. Thanks for the tips!, unclear Certainly utilizing the group’s remarks, nevertheless it really remanns to be seen the way this works

    Web Design Milton Keynes

  71. Howdy, My name is Kris Larsen and i’m an avid Metal Detectorist, i am choosing to develop a number of sites around the pastime of metal detecting and particularly around which ones are well worth purchasing and what you should prevent.

  72. Hi, My name is Kris Larsen and i am a passionate Metal Detectorist, i am choosing to create numerous sites with regards to the pastime of metal detecting and specifically around which ones are worthwhile purchasing and which you should stay away from.

  73. swim is best for us, car rearview mirror, car dvd

  74. Eskort bayanlar eskort evlicift bay bayan partner kamerali sesli sohbet odalarinda sende eskort arkadasinla tanıs guzellikleri paylas

  75. Stephen Hosking

    I’ve just finished the book, and think you’ve done a great job. I’ve put a review up in Amazon (5*’s, btw), but I just wanted to add that I liked the humour in the book! It’s a bit dicey for the author of a technical book to risk a few jokes, so I just wanted to re-assure you that yours did work! :) )

  76. Richard

    Hi Steve – great book! I am struggling with Validation section of Chapter 12 – Models and Data Entry. The last section suggests to put the model layer in charge of validation using the RulesException class. I can see the value in this, but in order to also implement client side validation, wouldn’t I need to repeat all the logic using, for example, Data Annotation attributes? I have noticed a few blog entries and articles from yourself on ASP.NET MVC data validation and would like to know which article/book reflects your latest thoughts on this subject. Kind Regards.

  77. I’m current working through the book, and the discussion of testing and dependency injection are quite valuable. Thank you for that.

    I am having a problem in chapter 4, with the css code on page 130. I’ve copied the site.css file from the sample code for download. I’m using IE 8 (regular and compatibility view) and Chrome, and have cleared out cached files.

    When I render the page shown in figure 4-21 on page 131, the “categories” div is only as tall as the text within it, and the “content” div wraps around it. The gray border on the left side of “content” isn’t visible.

    So I’m wondering if there’s something wrong with my machine or if the css file needs tweaking?

  78. …AND I feel like an idiot. My tag was missing the id for the content section.

    To quote Gilda Radner, “never miiiiiiind.”

  79. Pingback: ASP.Net MVC 3 Custom Membership Provider with Repository Injection | Dan Harman

  80. Amazing book. Its the most readable explanation of how to test on real projects, not just demoware.

    I’ve given it well deserved praise on this post about how to use DI’s repositories when creating your own membership and role providers.

  81. Lori

    Am enjoying your new MVC 3 book. When will the code samples be available? Thanks!

  82. Rob

    Hi, I’d like to see the updated code samples for the MVC 3 book as well!

    Please provide a link if at all possible!

  83. MSEC

    Hi, I downloaded the source code for Pro ASP.NET MVC and Pro ASP.NET MVC 2 from APress. When extracting the zip archive file, it creates a file with the zip filename and an extension of ‘File’. Can anyone fixed? Thanks!

  84. Earl

    I purchased Pro Asp.Net MVC 3 Framework. I downloaded the code for the book from the Apress site and the zip file will not open. Tried Windows 7 and Winzip. Where can I get a good copy of the book’s source code?

  85. Beginner

    Hello!I’m beginner in .net technology, especially in ASP.NET MVC.I read Steve’s book ASP.NET MVC and I got a touble with one piace of code.I can’t find method
    AddComponentWithLifestyle() in WindsorContainer container.I couldn’t find nothing in internet, only that this method is old or something like this.Thank you very much

  86. Lin


    I have a small issue working with the example on page 110, in the line,

    private IKernel kernel = new StandardKernel(new SportsStoreServices());

    the following error is coming up,

    “The best overloaded match for “NInject.StandardKernel.StandardKernel(NInject.INInjectSettings, params NInject.Modules.INInjectModule[])” has some invalid arguments.

    I have downloaded NInject version –

    Do you know what’s going wrong here?


  87. Cameron

    Hi there,

    Thanks for the book, have found it to be very good. I tried to get the source from the Apress site but the file appears to be corrupt. Tried to download it several times and tried a variety of unzip programs including the ones mentioned on the site. Was wondering if you have it available in another place.