Friday, November 9, 2012

Difference between Web Site and Web application in ASP.NET

• Development Wise Difference

Web Site
1. We can code one page in C# and one page in (Multiple programming languages allowed).
2. We cannot call (access) public functions from one page to other page.
3. Utility classes / functions must be placed in a special ASP.NET folder (the App_Code folder)
4. Web Sites do not have a .csproj/.vbproj file that manages the project (the folder that contains the site becomes the project root).
5. In the Web Site project, each file that you exclude is renamed with an exclude
keyword in the filename.
6. Explicit namespaces are not added to pages, controls, and classes by default, but you can add them manually.

Web Application
1. Only one programming language allowed per project (Need to decide on programming language when starting project).
2. We can access public functions from one page to other page.
3. Utility classes / function can be placed anywhere in the applications folder structure.
4. Web Applications are treated like other .NET projects and are managed by a project file (.csproj or .vbproj) .
5. One nice feature of the Web Application project is it's much easier to exclude files from the project view.
6. Explicit namespaces are added to pages, controls, and classes by default.

• Deployment wise difference

Web Site
1. It has its code in a special App_Code directory and it's compiled into several DLLs (assemblies) at runtime.
2. No need to recompile the site before deployment.
3. We need to deploy both .aspx file and code behind file.
4. Small changes to the site do not require a full re-deployment. (We can upload the code file that was changed) 

Web Application
1. web application is precompiled into one single DLL.
2. Site has to be pre-compiled before deployment .
3. Deploy only .aspx page, but not associated code file (the pre-compiled dll will be uploaded) .
4. Even small changes require a full re-compile of the entire site(i.e. if the code for a single page changes the whole site must be compiled) (It requires careful planning to ensure new bugs aren't introduced to the production site when uploading bug fixes or other changes.)

sample format of .CSPROJ file in web application
<Project xmlns="">
      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">

No comments:

Post a Comment