VS 2010 also ships with starter template projects that allow
you to create a new ASP.NET application that has some layout/CSS structure and
common functionality already implemented within it.
We first tried this concept with ASP.NET MVC 1.0 – whose
project template provides a master page, CSS file, JavaScript libraries, login
system, and a “home” and “about” page already wired up and implemented.
VS 2010 adds support for this idea when creating new ASP.NET Web Forms projects
as well.
When you choose the default “ASP.NET Web Application”
project template, you’ll find that the ASP.NET Web Forms project created
already has some directories and files contained within it:
Figure 2
It includes a Site.Master master page file that provides an
overall layout for the site (with headers, footers, etc), and which uses a CSS
stylesheet for all styles. It has a “Scripts” directory that contains
jQuery within it (ASP.NET AJAX is available via the script manager
control). It includes a “default.aspx” and “about.aspx” pages in the root
directory that are based on the master page and include some boiler plate
content. And it includes an “Account” directory that has some pages that
implement a forms-based authentication system for users to log-in, register and
change their passwords:
Figure 3
You can run the project without having to write any code or
configure anything, and get a nice site up and running:
Figure 4
The site has full support for forms based security
authentication, and is pre-wired up to use the ASP.NET Membership system for
password management:
Figure 5
All of the styles and content within the site are configured
using CSS, and take advantage of some of the new features with Web Forms in
ASP.NET 4 – including clean client-side “id” names (no more ctrl_ mangled names
– ASP.NET 4 gives you complete control over the client id), and CSS based
rendering instead of table based rendering for the built-in server
controls. I’ll discuss these new Web Forms features in a lot more depth
in later posts in this series (along with a lot of other features being added).