Channels ▼


Web Development Renewed

ASP.NET MVC Project Template

The Solution Explorer view of a typical ASP.NET MVC project template makes use of conventions and starts by creating Controller and Views folders:

The ASP.NET MVC Project Template in Visual Studio 2008.

  • Under Controllers you find all class files that contain controllers.
  • Under Views you find one subfolder for each controller. Each controller folder, in turn, contains the source files being used by the selected view engine to generate a response.

A typical project uses the default Web Forms-based view engine and outlines views using ASPX files. Neither index .aspx nor any other similar file is ever requested directly. Those files are simply helper files used by the view engine as the template for the page to render.

ASP.NET Web Forms and ASP.NET MVC pages can be mixed in the same application since they share the same runtime environment. However, ASP.NET MVC apps require a special configuration. For this reason, Web Forms pages can be hosted with ASP.NET MVC pages but not vice versa.

When To Use Which

ASP.NET MVC is a full alternative to Web Forms. But Web Forms isn't on its way out; it will continue to be improved. Choosing between them is a matter of personal preference and customer requirements. If you like Web Forms, then there's no reason you have to change.When making this choice, do consider the skills, education, and attitude of your development team.

6 New Features in ASP.NET MVC 2.0

1. Asynchronous controllers that increase the scalability of sites that interact with Web services
2. Strongly-typed HTML helpers for generating form input fields and reducing errors caused by typos
3. Client validation support for globalization data for multiple cultures
4. Server validation that renders model-level errors only
5. Templated helpers that automatically associate edit and display elements with data types
6. Html.RenderAction for rendering subsections of a page or site

If you're not happy with the level of testability and overall design that Web Forms offers, or if you're curious about new technologies, take a look at ASP.NET MVC. It's a completely new framework, designed with SoC and testability in mind. ASP.NET MVC lets you re-experience the way Web development used to be with stateless behavior, full control of HTML, and the freedom to use scripts and cascading style sheets however you want.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.