Introducing the ASP.NET MVC (Part 4) - Your First ASP.NET MVC Project

This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern. ...

January 6, 2009 · 7 min · 1457 words · Nick Berardi

Introducing the ASP.NET MVC (Part 3) - Installing the Prerequisites

This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern. ...

January 5, 2009 · 4 min · 847 words · Nick Berardi

Introducing the ASP.NET MVC (Part 2) - ASP.NET MVC vs. ASP.NET Web Forms

This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern. ...

December 29, 2008 · 9 min · 1715 words · Nick Berardi

Introducing the ASP.NET MVC (Part 1) - The Model-View-Controller Pattern

About a month and a half ago I announced that I am writing a book, I was really overwhelmed by the amount of support that I received from this announcement. Both myself and Al are really looking forward to the day when this book ships, and we start receiving real feedback on all our hard work. However, both of us would like to start receiving feedback as soon as possible, so… ...

December 14, 2008 · 6 min · 1230 words · Nick Berardi

ASP.NET MVC Has Changed My Life

Lately I have been neglecting my blog and not posting as often as I would have liked. I have had some very exciting things start up, at the begining of the summer, in my life that 6 months ago I would have said “no way is that going to happen.” These new adventures are the growing popularity of my blog, public speaking engagements, and a new book I was asked to write on ASP.NET MVC. Many of you picked up on the fact that I was writing a book based on my profile on the Philly.NET website, but I had officially announced it until this post. Many of my friends and family don’t even known I am writing a book so feel lucky in knowning you guys are some of the first people to know. ...

October 28, 2008 · 4 min · 771 words · Nick Berardi

ASP.NET MVC Goes Beta (Part 2)

From what I can tell ASP.NET MVC Beta is just ASP.NET MVC PR5 with a couple bug fixes. So the good news is that the interface has finally solidified and we shouldn’t see anymore breaking changes before the final release. New features: MvcFutures.dll is not included in the beta (as it wouldn’t be included in the final release) The Beta installer installs the ASP.NET MVC assemblies (System.Web.Mvc.dll, System.Web.Routing.dll, and System.Web.Abstractions.dll) into the GAC. New Simple Membership Features in the Default Project Template New Filter Types for Authorization and Exception Handling New Output Cache Filter Changes for ASP.NET AJAX Namespaces in Routes New Interface for Enhanced Testability of TempData ActionInvoker Extensibility Improvements ViewDataDictionary (minor change) ViewEngine Improvements Helper Improvements Controller and Filter Improvements Bug fixes: ...

October 16, 2008 · 2 min · 303 words · Nick Berardi

ASP.NET MVC Goes Beta

Wow has it really been 10 months since I first started using MVC. We have hit our first beta today. No information about what has changed, I will make sure to keep you all updated. But get it while it is hot: http://www.microsoft.com/downloads/details.aspx?familyid=a24d1e00-cd35-4f66-baa0-2362bdde0766 For everybody who hasn’t heard of MVC, how couldn’t you have heard about it now if you are a regular reader of my blog. But for all the new people visiting, here is an overview: ...

October 16, 2008 · 2 min · 271 words · Nick Berardi

ASP.NET MVC Preview Release 5

Looks like the MVC team has put out preview release 5 of the MVC Framework today. You can get the latest version from CodePlex. Here is what I can tell has changed from the release notes. What’s New Added global registration of view engines Changed the IViewEngine interface to add the RenderParial method Added support for rendering partial views Added a parameter to specify a default option label for DropDownList controls Moved ASP.NET AJAX extension methods to a separate namespace Added helpers for RadioButton and TextArea controls and made overall improvements to other helpers. Removed helper method overloads to avoid ambiguity Added array support for action method parameters Removed the ActionMethod property from action filter context objects Added support for custom model binders Added an IActionInvoker interface Added an UpdateMode method to the Controller class Changed HandleErrorAttribute so that it does not handle exceptions when HttpContext.IsCustomErrorEnabled is false Added a new AcceptVerbs attribute Added a new ActionName attribute Known Issues and Breaking Changes Controller class now is derived from ControllerBase class Controller.Execute as removed, it is not called ExecuteCore. Controller initialization steps should be done in Initialize method now. IViewEngine interface is now responsible for finding views, not rendering them. Some overloads to some helper methods have been removed. AJAX helper methods have been moved to a new namespace. This version is incompatible with Visual Studio 2008 SP1 Beta Upgrading from Preview 4 to Preview 5 System.Web.Abstractions and System.Web.Routing have been changed to version 3.5.0.0 Assemblies are located at %ProgramFiles%\Microsoft ASP.NET\ASP.NET MVC CodePlex Preview 5 Derik also noticed that many of the classes are still sealed, and is requesting that the team un-seals all classes, and I agree with him. ...

August 29, 2008 · 2 min · 326 words · Nick Berardi

Using a Parameter Attribute to set a Default Value in MVC

A couple days ago I came across a breaking change in ASP.NET MVC PR4 that wasn’t reported. The breaking change is that defaults from routes are no longer used as defaults for parameters in the action method, if no appropriate parameter is found in the request. Basically what this means is the following: I have the following route: URL: /home Controller: Home Action: Index Defaults = page: 1 I set the page so that it always defaults to “1” if no value is found in the query string for “page”. So when a request is executed, the Route passes back the RouteData.Values = controller: “Home”, action: “Index”, page: 1. Then it goes through it’s normally processing and the value of the page’s query string is passed in to my action method for the page parameter. So if query string page = 1 then 1, query string page = 2 then 2, and so on. This is how it worked in PR3 and how I understood it was suppose to work as a concept. However, in PR4, this doesn’t work anymore because of Line 166 in ControllerActionInvoker. It specifically checks that the value is in the route values. However they are always going to be in the route values if they have been defined as a default. ...

August 13, 2008 · 4 min · 836 words · Nick Berardi

MVC CAPTCHA for Preview Release 3

Since my last release of the MVC toolkit some major changes have taken place in the MVC Framework. I am going to do a quick run through of how they changed the MVC CAPTCHA for the better. Originally in MVC Preview Release 1 for the MVC CAPTCHA many of you remember that the indicator for a valid CAPTCHA was passed through the parameters of the action method like so: [ControllerAction] [CaptchaValidation("captcha")] public void Register(bool captchaValid, string otherParameters) { // do stuff } However when Preview Release 2 came out the ability to pass the parameter through the action method was broken. So I had to create a hack around this: ...

June 24, 2008 · 3 min · 575 words · Nick Berardi