ASP.NET Website Vs. ASP.NET Web Application Project

In general, people often get confused between Website and WebApplication Project in ASP.NET. Some might even think both are same. But in reality, there are some major differences between these two. In this blog, we will discuss about their differences and develop some idea to decide to choose one according to our need.

We deploy a web site to an ASP.NET web server like IIS. Just a collection of folders and files. There is nothing on a Web site (i.e., no project file) that binds us to Visual Studio. Changes to these files are recognised by the framework and automatically re-compiled. Web pages (such as.aspx,.ascx, and.master) are generated and compiled dynamically at runtime. We can pre-compile code that we want to share between pages and place the assembly in the Bin folder, or we can put it in the specific App_Code folder.
Web Application is a special Visual Studio project. The primary distinction between Web Sites and other projects is that with Web Sites, all code files are compiled into a single assembly during project construction and then stored in the bin directory. The web server doesn't get any code file deployments. We can put shared code files wherever we wish, just like we would in a class library, as opposed to having a specific folder for them. There is a Publish command in Visual Studio to output a Web Site to a defined location since Web Applications contain files that are not intended to be distributed, such as project and code files.
Deploying shared code files is generally a bad idea, but that doesn’t mean we have to choose Web Application. We can have a Web Site that references a class library project that holds all the code for the Web Site. Web Applications is just a convenient way to do it.
Some of the issues with website projects are addressed by web application projects. Because precompiling (publishing) a Visual Studio 2005 Web site generates many assemblies, some developers find it problematic to migrate Visual Studio.NET 2003 apps to the new Web site paradigm in Visual Studio 2005.
In some situations, Visual Studio 2005 Web projects are different from those in Visual Studio 2005, thanks to the new Web application project type. For instance, the new architecture has distinct semantics for Web subprojects that feed their generated assembly to a parent application's Bin folder rather than being an ASP.NET or IIS application. Developers that don't want to alter the way they structure their Web projects from how they do so now with Visual Studio.NET 2003 can use the new project type because it offers a model that will be comfortable to them. For instance, they can keep using project files. The Visual Studio 2005-introduced Web site project type, which offers a number of new capabilities and more freedom in how we manage Web applications, is not replaced by the new Web application project type. Instead, depending on our needs and desired development approach, we might use this alternate project type.
The default Visual Studio 2005 Web site project model will feel comfortable and simple to use for certain developers. The new Web application project model will be chosen by other developers because they prefer a paradigm where project resources are declared clearly (instead of implicitly by simply being in a folder) and where they have greater control over their project.
Excluding files from the project view is significantly simpler when working on a Web Application project. Each file we exclude from the Web Site project has its name changed to include the word "excluded" in the filename. The Web Application Project keeps things considerably neater by just keeping track of which files to include or exclude from the project view without renaming them.