Erik Lenaerts

Do, or do not. There is no try. - Yoda

Use masterpages in Web Sites and Web Application Projects

Since Visual Studio SP1, you have the option to choose between 2 approaches when building websites

  • ASP.NET Web Site
  • ASP.NET Web Application

The ASP.NET Web Application has been added in SP1 (actually you could download it seperately already before SP1)

There are some differences between both, basically the Web Application gives us back a project file like we had in Visual Studio 2003.

Initially Microsoft dropped the project files for ASP.NET in Visual Studio 2005 in favour for a location based approach (file system, IIS, ...). However because of too many complaints of the community, Microsoft undo its mistake and released the WAP (Web Application Project) and so restored the project files for ASP.NET, later on this was packaged into Visual Studio SP1.

My recomendation is to always use Web Application Projects which you can create using:

  1. File | New | Project menu
  2. Select the "Web" category in Visual C# or Visual Basic

 

Master Pages

Now the goal of this article is to point out the differences when working with master pages.

 

ASP.NET Web Site

In the last years you've probably worked with ASP.NET Web Sites. When you added a new Web Form you had the option to select if you wanted to use a Master Page or not like in the picture below

 

ASP.NET Web Application

If you now create a ASP.NET Web Application, you'll notice that the option is gone. Instead, there's a new item template called "Web Content Form".

Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: