when the beef brisket close to the end of debugging code, sometimes debugging half a day can not adjust what effect, helpless, first and the source comparison, found my Web layers in each page under multiple Aspx.designer.cs files (designer files), online said to have this file stating that you this project is Web applications instead of Web sites, and normal Web sites are ASPX (Web information) + CS (background code). What's the situation? I'm going to cry. From the beginning I set up the project is wrong, and look back at the beginning of the video to establish the stage of the project, later proved that my hypothesis is right, the question came again, but most of my functions can also be achieved ah, then they two what is different, Can we switch between each other? Originally they are designed ASP Web page,WEB Project has two kinds, A webapplication generates a Aspx.designer.cs file file, and a website is not generated Designer.cs .
One, Different:
1 , the former in the Add aspx the form will have a default namespace, while the Web Web site Web site After reference appears a bin folder where DLLs are stored
2 , the former has re-generated and published two; web sites have only one publishing site.
3. The former can be referenced as a class library, and a Web site cannot be referenced as a class library.
4 the former can add an ASP. Net Folder that does not include bin, App_code;web Web site can add ASP.
5 , the former is added to the page file after the default codebehind, and the site is coddfile
At this point I met the doubts are eliminated, why my page under the designer.cs file, why my cs There is a namespace in the code, and Codebehind is in the paging file .
Second, the respective advantages:
1 , Website:
dynamically compile the page, you can see the effect immediately, do not compile the entire site (the main advantage), you can make the wrong part and the use of the part of the non-interference (can require only compiled pass 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, you can also compile the page into the Assembly
2 , Applications:
The speed of compiling and publishing is noticeably faster, and when you publish it, you can set whether to overwrite it at the outset. The original site to upgrade, you need to generate a design code page. With this file, the compiler will no longer have to parse the ASPX page when compiling. Significantly faster compilation speed. And only one assembly is generated. The speed of execution page is fast.
Reference: Web application differs from Web site, Aspx.designer.cs file
Third, mutual transformation
1 , the website into the application:
VS2005SP1 built-in conversion program, it is very convenient to convert from website to WebApplication, only need to copy files, right-click "Convert to Web Application".
2 , the application translates to a website:
Delete all *.designer.cs and replace codebehind= "FileList.aspx.cs" in *.aspx, *.ascx, *.master paging file with codefile= "FileList.aspx.cs" in bulk.
Finally, the big site is more suitable for webapplication projects, small sites are more suitable for website projects.
feel: Now can only understand here, in short this time not seriously changed a lot of harvest, is fluke it, learning to hold a kind of attitude.
Web applications and Web sites