Difference between web site and web application in Visual Studio 2005


This article explains the concept of web site and web application in Visual Studio 2005

Introduction



If you are not very familiar with Visual Studio 2005, a "web site" and "web application project" may sound the same for you.

Microsoft introduced the concept of "website" instead of "web application" in Visual Studio 2005. However, due to demand from the development community, they re introduced the "web Application Project" which is pretty much similar to Visual Studio 2003 web application.

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!

    How to open a web site, if there is no project file?



    It looks bit confusing until you get familiar with the Visual Studio 2005 programming model.

    To open a web site (which do not have a project file), you need to first open Visual Studio 2005 and choose the menu File > Open > Website. It allows you to select a folder (not a project file). Thats all you have to do to view all the files part of the web site.

    Disadvantages of web site model



    Since there is no project file, there is nothing that you can double click to open the web site in Visual Studio for editing. You have to open Visual Studio first and then open the site from VS2005.

    Another disadvantage is, all files under the folder and considered to be part of the web site. There are lot of legacy web sites where more than one web site is combined into one folder, but properly managed the files by including them in appropriate projects. With the new model, since there is no project file, all files are considered to be part of the same website.

    How to exclude a file from a web site in VS2005?



    Many programmers keep lot of document files and backup files under the project folder. With the new model, they are all part of the web site. If you have backup files which has same class names, you may get compilation problems when they are compiled dynamically sicne they will be treated as duplicate classes. The only way you can exclude a file from the website within the same directory is by renaming them with the extension .exclude

    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.

    Which is best for me - Web site or web application project?



    Both has it's own advantages and disadvantages.

    A web site is good for you if you just want to create web sites and share with others. It is ideal for new projects.

    However, "web application project" is better if you are planning to migrate your Visual Studio 2003 or 2002 web sites into Visual Studio 2005. Otherwise you may end up spending lot of time to exclude unwanted files from your web site folder.

    Download Visual Studio 2005 Web Application Projects (RC1)



    As of April 2006, this is an Add-On to Visual Studio and not yet official released. You can download the beta version from here -

    http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/

    In future, this add on might become part of Visual Studio.

    Comments and Feedback welcome



    Please use the feedback link below to post your comments and feedback.


  • Comments

    Author: Vasudevan Deepak Kumar13 Jun 2007 Member Level: Gold   Points : 0

    It was really very informative and saved a bit of time now. When I researched still more, I found that SP1 now integrates it into the host product. Check out http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

    Author: Rashmi Bhimani01 Jun 2010 Member Level: Bronze   Points : 0

    Thank you, Useful article - detailed information.

    Author: Debasmit Samal01 Jun 2010 Member Level: Gold   Points : 1

    http://www.codersbarn.com/post/2008/06/ASPNET-Web-Site-versus-Web-Application-Project.aspx

    http://bytes.com/topic/asp-net/answers/613134-difference-between-web-site-web-application-project

    Author: Santosh Kumar Singh16 Jun 2010 Member Level: Gold   Points : 0

    good article....
    thnaks

    Author: saravanan17 Jun 2010 Member Level: Gold   Points : 0

    Nice and Helpful article...
    Keep it up!!!!

    Author: Sanchi21 Jul 2010 Member Level: Silver   Points : 0

    Good Article

    Thanks,Sanchi

    Author: Biju05 Aug 2010 Member Level: Gold   Points : 2

    USE [VKSRETANIUM]
    GO
    /****** Object: StoredProcedure [dbo].[Search_Company] Script Date: 08/05/2010 12:45:57 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO

    ALTER PROCEDURE [dbo].[Search_Company]
    (@Expression VARCHAR(8000))
    AS
    DECLARE @Qry VARCHAR(8000)
    BEGIN
    SET @Qry ='SELECT
    [Id]
    ,[Name]
    ,[CompanyContactId]
    ,[ContactPersonId]
    ,[IdentificationId]
    ,[CreatedBy]
    ,[CreatedDate]
    ,[ModifiedBy]
    ,[ModifiedDate]
    ,[ActiveStatus]
    ,[StoreId]
    ,[LedgerId]
    ,[CostCenterId]
    ,


    ,[SyncServerId]
    from [Company]
    where '
    + @Expression
    EXEC (@Qry)
    END

    Author: Alex Kumar05 Aug 2010 Member Level: Gold   Points : 0

    Nice Article

    Author: ghjjfgnj20 May 2011 Member Level: Silver   Points : 1

    web application is that application which is not uploaded


    web site is uploaded, it has port number, host name

    Author: ketan Italiya02 Aug 2013 Member Level: Gold   Points : 0

    hmm..right web-application can't uploaded.
    when website is uploaded..both are run on server.both's diff. is so much interesting.this information is helpful.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: