Skip to main content

Difference between Web Site and Web Application in

WebSite vs WebApplication, know all the differences between these two types of applications in Visual Studio

webapplication vs website

I've been asked several times what is the difference between Website and WebApplication in Visual Studio (where WebSite is present only in versions 2005, 2008 and 2010). If you aren't familiar with Visual Studio 2005/2008/2010 you may think that a WebApplication and WebSite are the same. I would like to tell a story to explain this further.

In Visual 2002 and 2003 there was only WebApplication and it was never spoken about WebSite. With the arrival of Visual Studio 2005 along with the framework .Net 2.0, it also appeared what Microsoft thought to be the salvation of the collaborative world of coding: The WebSite.

Guess what happened at the launch of Visual Studio 2005? The VS 2005 for web projects had only the option of WebSite and then the community complaints began. The complaints gained strength and Microsoft included in the Service Pack 1 for Visual Studio 2005 the option of WebApplication which was very similar to the 2002 and 2003 previous versions (Remember: before Service Pack 1, it was released a specific update to support WebApplication, but for those who still use the VS 2005, I highly recommend updating the SP1 and other updates from Microsoft Update).

WebSite in Visual Studio

A Website is just a group of files in a folder and subfolders where the classes are in the same namespace (in Java, namespace is similar to the package).

Something interesting about Website is that, when debugging an application, you can change the source code of a class (.cs or .vb) and continue the debugging process obeying its changes, something that is not possible when using WebApplication.

You can create a WebSite using the menu "File > New > Web Site...". There are three options for the file location:

  • File System: Allows you to choose a physical folder.
  • HTTP: Allows you to choose a virtual folder.
  • FTP: Allows you to choose an FTP address.

In any case above no project file (.csproj or .vbproj) is automatically created. There will be neither a "bin" folder (except in deploy - explanation below) nor a single assembly file (dll).

The biggest difference between Website and WebApplication is in the deployment ("Publish"). In WebApplication, the deployment process simply consists in a DLL for each project in a solution (.sln). In WebSite, we have 3 deployment options as described below:

  1. Fully open source code: This type of deployment maintains all your source code in the host server, including classes. To perform this type of deployment, just copy all the files from the Website folder to the Web Server or use the "Copy WebSite" option as described below:
  2. Source code of precompiled classes and pages (.aspx) with open source.
    To publish your site so that only the classes must be precompiled, you must keep your "Publish WebSite" this way:
  3. All WebSite precompiled, including pages (.aspx).
    In this option, the pages (ASPX) will be with only one line of code: "This is a marker file generated by the precompilation tool, and should not be deleted!", that is, the file is only for the web server to know that the page exists, since all the contents will be precompiled in the "bin" folder.

A tip for those using the types 2 and 3: Use "Use fixed naming and single page assemblies" option. This option will set fixed names for the DLL files. If you do not use this option, each generated deploy will change the DLL names and you will get unused files in your BIN folder (if you delete your entire site before publishing it, it makes no difference using this option).

Web Application in Visual Studio

To create a WebApplication: File > New > Project. Select Web and then choose the application type ASP.NET Web Application.

A "Web Application Project" organizes the project files in a file called <ProjectName>.csproj (C#) or <ProjectName>.vbproj ( These files can be useful for those performing auto deploy along with the Source Safe creating "labels" (or "tags" with SVN), for instance.

Its only type of build or deployment creates a single DLL file (precompilation) that is in the BIN folder of the project. In WebSite, everything that is added takes part in the deployment, on the other hand, in Web Application, it is possible to add DOC files, for example, and setting them so that they will not take part in the deployment. To do this,  click the mouse right button on the desired file in the project and then "Properties", change the "Build Action" to "None".

Web Application has its classes organized by namespaces, classes can be created in any folder of the project, unlike what happens in Website where you can only enter classes in App_Code folder.


We know that .NET has two phases of compilation. The first one, when you perform the build, is the so-called precompilation where the DLL files are precompiled in a common language (Intermediate Language) for .NET Framework. The second one is when the application runs, at this moment, the binary compiling occurs.

Because the application compilation occurs two times,  the speed in Website is being questioned and it will depend on the type of deployment (as seen above) used. Deploy Option 3 of WebSite should be considered the fastest, but during tests performed on the client (browser),  the result is negligible compared to Web Application.

Comparing WebSite X Web Application

   WebApplication WebSite
Project file Yes No
App_Code folder Yes* Yes
Classes organized by Namespaces Yes No
Deployment Options 1 3
Classes changing in Debugging No Yes
Page changing (.aspx) in Debugging Yes Yes
File Properties in the project Yes No

*You must create it manually using the New Folder option and, if necessary, change the property "Build Action" of the classes inside App_Code folder to "Compile".


Using Website or Web Application can appear, depending on the case, indifferent, so it is necessary to analyze the environment, the way of managing the source code, versioning and generation of builds and deployments.

From my personal experience with ASP.NET, I realized that Website has already caused some problems in the company I work related to references, deployments and Source Safe / SVN versioning.

In a Web Application we have better control over configuration, mainly because we have the project properties and the properties of each file in Visual Studio. Due to these properties we can better work with COM+ objects (eg, setting Copy Local = true on the reference). We can also generate builds in Debug and/or Release mode and the source code is organized into namespaces.

Probably if you use Visual Studio just at home for personal projects, you may end up liking Website, but when using it in large enterprise projects where build and deployment are key parts of the process, Web Application ends up being the best option.

published by Mauricio Hernaski