If you’re developing applications today using ASP.NET, you have two choices for development using Microsoft tools: Web Forms and MVC. I’ll review what each is, what each does, and when you might want to choose one over the other.
ASP.NET Web Forms
ASP.NET Web forms is a mature technology that runs many large scale websites and is the traditional style of ASP.NET web development. Starting in the .NET framework version 1.0 it is the first technology where Microsoft made an effort to make web development very robust and much more simple. The web forms declarative syntax plus the event driven model allows you to take full advantage of visual designers by drag and dropping the controls onto ASP.NET pages and then writing code against them, much like Windows style development. This makes web forms development very enticing for a wide range of developers on both Windows and other platforms, where drag and drop development via visual designers is common and also provides a separation of web content and web page GUI logic. The key features of web forms include:
- Mature technology
- Rich toolset & controls
- Event driven model
- Easy state management
- Abstracts HTTP
- Feels like Windows development
Web forms can do great things for you, there are some downsides, notably ViewState and the PostBack model, both which are a blessing and a bane. ViewState, which is a mechanism that consists of using hidden fields for transporting data between the client and server, can become ridiculously large. This is especially true when combined with some ASP.NET server controls such as a DataGrid or GridView. The PostBack model also has some challenges to it in the form of rendered JavaScript for every action to trigger the postback. (outside the default HTML <input> tag). This leaves you the developer less control over how the client invokes communications to the server.
While there are a few gotchas with working with web forms, you can still develop solid applications. Web forms delivers on flexibility too, with various provider plug-ins, HTTPHandlers and HTTPModules that you are free to create to extend as you need.
ASP.NET MVC
MVC (Model View Controller) isn’t a Microsoft technology (and, it’s not even new). , it’s a pattern for web page creation that’s been around for some time now in other frameworks and just recently implemented in ASP.NET. As a developer using MVC you can get a ‘closer to the metal’ experience and finely tuned control of the HTML output, which will be exactly as you define it. Whereas web forms renders output based on your selections of controls and code, MVC is primarily your code with some HTML interspersed, so you get control of each pixel that’s rendered.
The three features of MVC, the model, view and controller are described here…
- The Model can be thought of as the data. This is going to be your fat layer, with all the goodies in it.
- The View is the UI representation of the Model. The view will render the model along with HTML, JavaScript and other page elements.
- The Controller chooses the view to be rendered and responds to user input. The view also manipulates the model, as needed, so the controller is the component that ties the Model and View together. The controller will be the most lightweight code-wise of the three.
As you can see, the MVC approach requires you to work with three objects rather than just one object (the page object) as web forms does. This object trio does give you some advantages over the traditional model:
- It’s testable, you can unit test easily
- Clear separation of concerns
- Control your output exactly
- Map URLs logically or dynamically
- Supports many web forms features (auth, caching, etc…)
- More geeky, higher coolness factor
Another contrast to web forms is the use of URL routing. When using URL routing with MVC you don’t have a direct one to one URL/address that corresponds to a single .aspx page on the web server. Your URL maps to a controller and action instead. This should give you lots of flexibility to design SEO friendly web sites, as well as make the browser’s address bar a first class citizen in your web application; after all, users now routinely use the address bar as part of a web site.
Choose Your Poison
But isn’t web forms going away, you ask? No. It’s not. MVC is just another choice of technologies for web development using ASP.NET. Web forms isn’t going away, and isn’t going to stagnate either. You will see a lot more goodies to come from the ASP.NET web forms team.
So it’s up to you to decide what you need based on your team and application’s technical requirements. If your shop is an agile shop or TDD shop you’d be better off choosing MCV. If you need really fine tuned output and control over the rendered HTML, then MVC is for you too, otherwise, web forms should suit you fine.
And finally, you can mix MVC and web forms in the same application. So you don’t have to run out and convert your entire project over to MVC if it currently exists as a web forms project.





