
Creating Web Sites and Web Application Projects
Formally speaking, an ASP.NET Web application is a collection of files and folders hosted on a Web server.
Here are the most common files:
• Any number of ASP.NET Web files, including .ASPX, .ASCX, .ASMX, .ASHX, .MASTER, and
their related code-behind files.
• One or more optional Web.config files and one optional Global.asax for handling application and
session events.
• Resources, such as images and external documents (*.xml, *.html, etc).
• A /bin/ subfolder, which contains any private assemblies referenced by the ASP.NET Web
application.
• Special ASP.NET subfolders (for example: App_Theme), which contain additional files that
support the Web site.
In Visual Studio 2008, both ASP.NET Web Sites and Web Application Projects have their advantages and
disadvantages. ASP.NET “Web Sites” can be created on the file system, on IIS or on an FTP server. ASP.
NET “Web Application Projects” can only be created on the file system. Both ASP.NET application types
are supported by Visual Studio 2005 SP1 and Visual Studio 2008, although Visual Studio 2008 adds more
designer support for Web Applications Projects. The best choice depends on the existing project structure,
the development/deployment environment, Web hosting system and team member experience.
IMPORTANT: This courseware uses the term “Web Application” to loosely refer to both “Web
Sites” and “Web Application Projects”.
Consider the following side-by-side comparison.
We will make use of Web Application Projects and Web Sites in this course to help you understand both of
them. You will create both types of ASP.NET Web Applications in your lab.
To create a new Web Site in Visual Studio 2008, click File | New | Web Site... Notice that Web Sites are
separate from Visual Studio Projects.
You will be able to specify the location to host the Web content and the method of hosting. In the upper right
corner, you select the version of the .NET framework you’d like to work with: .NET 2.0, .NET 3.0 or .NET
3.5. The Location drop-down allows you to pick from File System with WebDev.WebServer.exe, HTTP
with IIS, or FTP with an FTP server. The Language dropdown allows you to pick the .NET language you
wish to program with – C# or VB.
Looking at the type of Web sites you can create and what you’ve learned so far about .NET, there are a few
points to keep in mind. Selecting a .NET language only affects the initial file created with the site. The WCF
Service project type is only available if you choose .NET 3.0 or .NET 3.5 as the active framework. By
default, the ASP.NET AJAX framework is only available with .NET 3.5.
To create a Web Application Project in Visual Studio 2008, click File | New | Project… Here you can choose
the .NET language of your choice on the left side and the Web project type on the right side.
Again, you’ll notice the same level of support for WCF Service (.NET 3.0 and newer) and AJAX
applications (.NET 3.5). You’ll also notice that you can only create Web projects on a file directory structure.
Once created, every Web file that you add to this Web project must be of the same .NET language (C# or VB).
Again, for ease of learning, this course will demonstrate the use of both Web development methods. Unless
specified, the labs will be developed on the file system, making it easier to take your completed work home
with you at the end of class.
Creating Web Sites and Web Application Projects
Table of Contents
Copyright (c) 2008. Intertech, Inc. All Rights Reserved. This information is to be used exclusively as an
online learning aid. Any attempts to copy, reproduce, or use for training is strictly prohibited.
Courseware
Training Resources
Tutorials
Option or Task
|
Web Application Project
|
Web Site
|
Need to migrate/support existing Visual Studio Web Application Projects
|
X
|
|
Prefer “single file” model to code-behind model for easier deployment
|
|
X
|
Prefer deploying changed code-behind files individually to the Web server and having them automatically compiled when the Web page is initially requested, thus simplifying deployment.
|
|
X
|
Prefer having all code-behind files compiled into one DLL in the /bin/ folder, for higher security
|
X
|
|
Prefer project references and designer behavior to be closer to Windows application development
|
X
|
|
Prefer or need to develop on IIS or an FTP server
|
|
X
|
Need to build a Web application using multiple Web projects
|
X
|
|
Need to add pre-build and post-build steps during compilation
|
X
|
|
Want to open and edit any directory as a Web project without creating a project file
|
|
X
|
Need Web pages to be written in more than one .NET language (C# and VB, for example)
|
|
X
|
|
Services