Introduction to ASP.NET MVC (Part One)

Hello internet,

Today is the D day in which I present to you this wonderful piece of art called ASP.NET MVC. So without any delay I’ll start with a quick introduction about the technology, then I’ll walk you through its release history and finally I’ll conclude by giving you a short description of ASP.NET MVC latest features.

Quick Intro to ASP.NET MVC:

To keep it simple I will say that ASP.NET MVC is a framework for building websites/web Apps that applies the Model-View-Controller pattern to the ASP.NET framework.

Woow! wait a minute What does all that mean?

OK, I’ll explain it bit by bit.

For now, let’s say that a Model-View-Controller pattern is a type of architecture or a structure used in software building. Model represents the data, View is the graphical user interface (GUI) and finally the Controller provides model data to the view and react to user’s actions such as hovering over an element of a given web page.

Don’t confuse yourself too much cause I intend to write a special post about this important but yet hard to truly grasp topic.

So, to come back to our subject, I’ll say that we use this kind of architectural pattern to create ASP.NET Web Apps and websites. Clear enough?

OK, but how these two frameworks work together ?

Way back in the early days of ASP.NET creation (2002), people used to think of Web Forms and ASP.NET as the same thing. In fact, the former was part and parcel of the latter which was composed of :

– System.Web.UI: Representing an .aspx file, also known as a Web Forms page, requested from a server that hosts an ASP.NET Web application.

–  System.Web:  The conducting channel which supplies classes and interfaces that enable browser-server communication.

This means that the development process with ASP.NET included the whole Web Forms tools ( you can read more about ASP.NET Web Forms here). But unfortunately, the story had a dark side represented by: a confusing page life cycle and HTML pages were difficult to customize…and the list was long.

Of course there was a way out of this situation but it was really painful cause there was no built-in patterns at that time and programmers had to deal with it manually with the help of handlers, modules and other handwritten code. Luckily, the MVC pattern started emerging as one of the most popular ways of building web frameworks setting the stage for the ASP.NET MVC announcement in 2007.

From MVC 1 To MVC 5:

For  an optimal understanding of MVC 5, one should not neglect how the framework evolved throughout its five releases. In this section, I will give you a short outline of each version.


What started as “this cool thing I wrote on a plane” by Scott Guthrie (aka “Scott Gu”), will end up being the embryon that will revolutionize the whole Microsoft web development community. In fact, on his flying trip to a conference, in February 2007, on the East Coast of the United States, Scott managed to write an application that didn’t exceed few hundred lines of code that encapsulated the whole idea of a new architectural pattern called MVC.

The love at first sight came when he presented his work to a group of developers in the Austin ALT.NET meeting in October 2007 in Redmond, Washington. Since that time, many developers were involved in the project prototype which was called then Scalene. 

On March 13, 2009 ASP.NET MVC 1.0 was officially released including code and unit tests.


One year after the first release, MVC 2.0 saw the light in March 2010. And if we check what was mainly new about it we will find:

Template Helpers: Allow you to automatically connect your HTML elements for edit and display with data types. (For more information check out this link)

Areas: Let you fragment a large project into small pieces/sections to help you manage complexity. (For more on this check out here)

Support for asynchronous Controllers: Add more performance on server side allowing controllers to process requests asynchronously. (Again, you can check out here for more details)

Support for DefaultValueAttribute in Action-Method Parameters: Allow a default value to be supplied as an argument parameter to an action method.

Support for Binding Binary Data with Model Binders.

ModelMetadata and ModelMetadataProvider classes: Provide an abstraction to obtain metadata for the model within a view. (For more information, you can check the msdn documentation on ModelMetadata and ModelMetadataProvider)

Support for DataAnnotations Attributes: Add multiple attributes like RangeAttribute, RequiredAttribute, StringLengthAttribute, and RegexAttribute when you bind to a model to provide input validation. (I definitely encourage you to visit this link for more details)

Model-Validator Providers: An abstraction that provides validation logic for the model.

Client-Side Validation: Adds a client validation library and adapter that consumes the validation metadata exposed to the browser in the form of JSON-serialized data.

New Code Snippets for Visual Studio 2010: Tools -> Code Snippets Manager -> language(HTML) / location(ASP.NET MVC 2)

New RequireHttpsAttribute Action Filter: Applied to action methods and controllers to redirect a non-SSL(HTTP) request to the SSL-enabled(HTTPS) equivalent.

Overriding the HTTP Method Verb: Introduces new attributes with compact syntax that can be applied to action methods, such as HttpPost, HttpGet, HttpPut…

New HiddenInputAttribute Class for Templated Helpers: Applied to model properties to indicate whether a hidden input element should be rendered when displaying the model in an editor template.

Html.ValidationSummary Helper Method: To display only model-level errors.

Alright! I think that I’ve listed almost everything. So, let’s see what happened on the API level.  Actually, there was a bunch of properties and methods that were added:

protected virtual CreateActionInvoker method in the Controller Class: invoked by the ActionInvoker property  and allows for lazy instantiation if no invoker was set.

protected virtual HandleUnauthorizedRequest method in the AuthorizeAttribute Class: enable filters deriving from AuthorizeAttribute to control behavior when authorization fails.

Add(string key, object value) method in the ValueProviderDictionary Class:  let developers using the dictionary initializer syntax for ValueProviderDictionary.

get_object method in the Sys.Mvc.AjaxContext Class: a Javascript method similar to get_data method, however if the response’s content-type is application/json, it returns the JSON object.

– ActionDescriptor property in AuthorizationContext Class.

– UrlParameter.Optional token: used as a way out for problems that occur when binding a model that contains an ID property to a form post that had no ID whatsoever.(For more information on the subject check out Phil Haack’s post)

That’s it for now. Don’t forget to check out my next post to continue with me in my ASP.NET MVC journey.

GoodBye internet!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by

Up ↑