ASP.NET 2.0 - Web Site vs Web Application project

A common question by asp.net developers is what project model should I use for asp.net application? Web Site project (which introduced with VS 2005) or Web Application project (which delivered as add-in for VS 2005 and built-in within VS 2005 SP1)?

There is no thumb rule. Every project model has it's own advantages (and diss-advantages off course...). I hope this post will help you to understand better the differences between 2 of them.

Web Application project model

  • Provides the same Web project semantics as Visual Studio .NET 2003 Web projects.
  • Has a project file (structure based on project files).
  • Build model - all code in the project is compiled into a single assembly.
  • Supports both IIS and the built-in ASP.NET Development Server.
  • Supports all the features of Visual Studio 2005 (refactoring, generics, etc.) and of ASP.NET 2.0 (master pages, membership and login, site navigation, themes, etc).
  • Using FrontPage Server Extensions (FPSE) are no longer a requirement.

Web Site project model

  • No project file (Based on file system).
  • New compilation model.  (Read here or here for more details) and ...
  • Dynamic compilation and working on pages without building entire site on each page view.
  • Supports both IIS and the built-in ASP.NET Development Server.
  • Each page has it's own assembly.
  • Defferent code model.  (Read here for more details)

Ok, all is great, but you want to create your web site now. Which model should you use?

  • You need to migrate large Visual Studio .NET 2003 applications to VS 2005? use the Web Application project.
  • You want to open and edit any directory as a Web project without creating a project file? use Web Site project.
  • You need to add pre-build and post-build steps during compilation? use Web Application project.
  • You need to build a Web application using multiple Web projects? use Web Application project.
  • You want to generate one assembly for each page? use Web Site project
  • You prefer dynamic compilation and working on pages without building entire site on each page view? use Web Site project
  • You prefer single-page code model to code-behind model? use Web Site project

 

Additional Reference:
        http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx

Reference:

http://maordavid.blogspot.com/2007/06/aspnet-20-web-site-vs-web-application.html

你可能感兴趣的:(application)