Reader Level:
ARTICLE

ASP.NET Website vs Web Application project

Posted by Kalyan Bandarupalli Articles | Learn .NET February 23, 2009
This post explains about two project types in Visual studio ie Website and Web Application that we use to build the ASP.NET Applications and the fundamental differences between the two project types..
  • 0
  • 0
  • 62421

Introduction

This post explains about two project types in Visual studio i.e. Website and Web Application that we use to build the ASP.NET Applications and the fundamental differences between the two project types.

Background

Website project type was introduced in the VS 2005 and Web Application model introduced in VS 2003. Website project type is based on folder structure and does not require a project file. Later in VS 2005 sp1 project file was introduced for the VS 2005 website project type. Now in VS 2008 we can create both project types.

  1. You can add Website or Web application project to your VS solution in VS 2008 as follows

    aspwebsite1.gif
     
  2. I have added two project types to the solution and it looks like the following

    aspwebsite2.gif
     
    • Fundamentally the behavior of the application types is same but website project type is folder based and WebApp is project type like normal project types in VS studio. In WebApplication project type project file defines the structure of the project.
    • WebSite project type contains the folders and anything that you put in the folder are dynamically compiled and be part in the website. More about ASP.NET Website Dynamic compilation here.
    • WebApplication project type contains the designer for the ASPX page and you can find the bin folder which contains the compiled assembly.

    So First difference can be summarized like ASP.NET website project type is dynamic and WebApp is more like structured.
     
  3. When you add a class file to the website project it will prompt you that it will place the file in App_code folder under root.

    Notice In website project type namespace won't add to the class by default however you can define the namespaces explicitly where as in WebApp it creates the namespace for the class file when you added it to the project.
  4. WebApp project type is restricted to one language where as Website you can add different language files to the App_Code folder which compiles the files dynamically.
     
  5. Referring a user control in WebApp is straight forward.You can define the properties and can be accessed in class files like any other objects where as in website it is not.
     
  6. We can put multiple language files in the Website but those files needs to be in same folder. If you change the location of the file then you need to mention in the Web.Config file as follows..

    <codeSubDirectories>
    <add directoryName="Testfolder"/>
    </codeSubDirectories>

    In compilation process you will have the finer degree of control in WebApp and it is not in Website because everything is dynamically compiled.
     
  7. When you deploy the WebApps you can just copy the Compiled Assembly and Visual elements to the IIS folder where as in Website you need to copy everything to the IIS to work.
     
  8. You can see the following dialogue box when you publish the files in Website

    aspwebsite3.gif

    If you select the precompiled option then you will find the precompiled folder in the published location there you find the multiple assemblies for each folder in the website.
     
  9. If you use WebApplication project you can not access Profie at design time a workaround solution can be found here.
     
  10. The following link helps you to choose which project type you have to user for the developing web applications.

    http://blogs.microsoft.co.il/blogs/maordavid/archive/2007/06/03/ASP.NET-2.0-_2D00_-Web-Site-vs-Web-Application-project.asp

Article Extensions
Contents added by Kadiya Saurabh on Jan 01, 2013
Hi!
My name is Saurabh.

My topic is a ASP.NET with C#

My Problem is How Can For Connetion String And Next Problem is How can Session Use.
Contents added by ASHOK KUMAR K on Jul 14, 2012
COMMENT USING

Trending up