C # ASP. NET new project differs from new site

Source: Internet
Author: User

Http://blog.sina.com.cn/s/blog_9a9e0bd601017iz3.html

Web application----Web site

Default.aspx Web application shows two original files and Default.aspx.cs and Default.aspx.designer.cs; Web site default.aspx displays an existing file Default.aspx.cs.

The 2--web application has two items to regenerate and publish, and the Web site has only one publishing site.

3--web applications and general WinForm there is no difference between the reference is the namespace, etc., the Web site after the reference appears in a bin folder where the DLL and PDB files are stored.

4--web applications can be referenced as class libraries, and Web sites cannot be referenced as class libraries.

The 5--web application can add an ASP. Net Folder that does not include bin, App_Code, or theWeb site can add an ASP.

6--web applications can also add components and classes, while Web sites do not.

7--source files are Default.aspx.cs but the Web application has a namespace and a system.collections space reference.

The 8--web application needs to be recompiled after modifying the underlying code of the page, and the site does not need to be recompiled.

9--Web site can add APs folder, Web application not can.

The project for the 10--web application generates the DLL file. When the site is published, DLL files are generated automatically, but each time the DLL file name is different.

11--web applications will have solutions and project files, there are more obvious Web application if the CS file is modified, you need to compile, and Web site does not need a

In ASP. ASP can be created . NET Web sites and ASP. NET Applications , there is a difference between the ASP and the process of developing and compiling the ASP.

Asp. NET applications mainly have the following features:

You can split your ASP into multiple projects for easy development, management, and maintenance.

2--can exclude a file or project from the project and from source code control.

3--supports VSTS Team Build for easy daily builds.

4--can customize the name, assembly, and so on before and after compilation.

5--support for App_GlobalResources's resource strong class.

Advantages of the WebApplication programming model:

The website compiles quickly, uses the increment compiles the pattern, only then the file is modified, this part only then will be the increment compiles in.

The generated assembly
WebSite: Generates a random assembly name that requires plug-in webdeployment to generate a single assembly
WebApplication: You can specify that a Web site project generates a single assembly because it is a standalone assembly, so you can specify the name, version, output location, and so on for the application set as you would any other project

You can split a site into multiple projects for easy management

You can exclude a file from your project and source code control

Team Build with VSTS support for daily builds

More powerful code checking capabilities, and check policies are controlled by source code

You can do your own processing before and after compiling.

Resource Strong support for App_GlobalResources (online, not yet known)

Direct upgrade of large systems built using VS2003


Advantages of the Website programming model:

Dynamically compile the page, you can see the effect immediately, without compiling the entire site (main advantage)

Same as above, can make the wrong part and the use of the part of the non-interference (can require only compiled through to check in)

You can generate an assembly per page (not in this way)

You can use a directory as a Web application to process, directly copy files can be published, no project files (no matter, only for small sites)

The page can also be compiled into the assembly (should not be used, and webapplication can also be implemented through the Webdeployment plugin)


Conversion of two programming models:

The VS2005 SP1 has a built-in conversion program that can be easily converted from website to WebApplication
Just copy the file and right-click on "Convert to Web Application" to do so.
There are no specialized reverse conversion tools found, but comparisons find that if the conversion is very simple.

Delete all *.designer.cs
Bulk replace codebehind= "FileList.aspx.cs" in *.aspx, *.ascx, *.master paging files with codefile= "FileList.aspx.cs"


The above is copied, I compare the next and.
Directly build the site, no namespace, there are several special folders such as the App_Code folder cannot be created directly in the site project, but can be added manually and then included in the project.


To use the WebApplication program we need to install the Visual Studio 2005 Team Suite CHS patch in order to convert a Web site project into a Web application.

Web programs are somewhat different from general programs, and VS does not have to establish engineering (project) files for them, so it can also be called Non-engineering development (projectless development), to ensure that the site directory is clear, not chaotic, Helps the final configuration of the Web application, can completely copy the entire directory simple , because there is no redundant files. At the same time, no engineering development can facilitate team development, because the respective development files do not need synchronization. In VS there is also engineering-based web development, which can be called Web Engineering (Web projects), which is actually the previous development model, the purpose of existence, one is that may need to migrate the previously developed web works to VS2005, and the second is sometimes need to include multiple projects in a site, Third, the Web project can flexibly handle the site's resource files, such as a large number of images, in the development, can not be included in the project, and four, if you use the MSBuild tool, you must use the project file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.