Wednesday, December 15, 2010

Difference between Website and Web Application in ASP.NET

Web site in Visual Studio 2005:


A web site is just a group of all files in a folder and sub folders. There is no project file. All files under the specific folder - including your word documents, text files, images etc are part of the web site.

You have to deploy all files including source files (unless you pre compile them) to the server. Files are compiled dynamically during run time.

To create a "web site", you need to use the menu File > New > Website

You will have the option to choose either one of the following location types:

# File System - Allows you to choose a folder to put all the files.
# Http - Allows you to choose a virtual directory to put the files.
# FTP - Allows you to choose an ftp location.

In any of the above cases, no project file is created automatically. Visual Studio considers all files under the folder are part of the web site.

There will be no single assembly created and you will nto see a "Bin" folder.

The benefits of this model is, you do not need a project file or virtual directory to open a project. It is very handy when you share or download code from the internet. You just need to copy the downloaded code into a folder and you are ready to go!




Web Application Project in Visual Studio 2005:


Microsoft introduced the "web site" concept where all files under a web site are part of the site, hoping that the development community is going to love that. In fact, this is very usefull to share code.

However, they did not consider millions of existing web applications where people are comfortable with the "project" based application. Also, there were lot of web applications where several un wanted files were kept under the web site folder. So, the new model did not work well for them.

When people started screaming, Microsoft came up with the answer. On April 7, 2006, they announced "Visual Studio 2005 Web Application Projects" as an Add-On to Visual Studio 2005. This Add-On will allow you to create and use web applications just like the way it used to be in Visual Studio 2003.

The Visual Studio 2005 Web Application Project model uses the same project, build and compilation method as the Visual Studio .NET 2003 web project model.

All code files within the project are compiled into a single assembly that is built and copied in the Bin directory.

All files contained within the project are defined within a project file (as well as the assembly references and other project meta-data settings). Files under the web's file-system root that are not defined in the project file are not considered part of the web project.

No comments: