asp.net one, code-behind (asp.net 1.0/1.1)
Vs.net 2002 (2003) uses a feature called Code-behind to separate HTML, control, and application logic, and the default Code-behind file automatically inherits System.Web.UI.Page attributes, which automatically correspond to events. Designer changes are reflected in the Code-behind file in a timely manner, saving a lot of time to enter the code. When you first move into this form of development from an ASP's hybrid development, you're excited about the convenience of this feature. But at the same time, Code-behind also brings some limitations, First, any modification of the Code-behind file must cause the entire project to recompile; second, the compilation of a single assembly for many people to develop a certain degree of limitation; and then there is the synchronization problem for ASPX and Code-behind class. For example, you may suddenly find that you do not know when a button actually has no effect, looking for a long time later found that the original InitializeComponent () in the event of the state will not know when the Code-behind class lost. Finally, Adding a single. aspx file is difficult, although you can rename it to an. aspx file by adding a. txt file, but in this case some IDE design support with the Code-behind aspx file is now gone. Editing this. aspx file root Notepad is not much different.
Second, dynamic compilation
To address some of the negative effects of Code-behind, ASP.net 2.0 offers some very productive features, such as dynamic compilation. Therefore, the name of righteousness, dynamic compilation to resolve every time you modify the Code-behind file must recompile the entire project, Instead, the user dynamically compiles the first time it is requested (which, of course, brings a certain performance penalty), but then it's no different from precompiling, which is especially suited to the need to change the class file, which requires you to restart the Web every time you modify it. Application.Asp.net 2.0 provides a special folder called Code. In this \code directory, you can put your business Logic component or data Access Component,resource resource files, and so on, so none of these need to be compiled, and the development environment also supports smart hints (which must be compiled in vs.net2002 to implement this functionality).
Third, precompiled support
Although ASP.net 2.0 provides dynamic compilation functionality, because dynamic compilation has a certain performance impact on the user's first visit, not all situations are appropriate, and you probably don't want to expose the source code when you publish application, so asp.net 2.0 also supports precompilation, ASP.net 2.0 supports two different precompilation:
1, In-place precompilation
Precompilation in this way is done in a form like this
Localhost/webapplication/precompile.axd
If there is a bug in the program, it immediately interrupts and shows that everyone is familiar with compiling the wrong screen to make the error, if everything is OK, then display the following information:
The application was successfully precompiled.
This kind of precompilation mainly solves the performance impact of the first access caused by dynamic compilation.
2, precompilation for deployment
This form of compilation is done by a command-line based tool, in the form of the following:
aspnet_compiler/v/<websitename>–p <source> <destination>
The following figure is a compilation screenshot of my Test
The compilation requirements for this schema <websitename> must be an available IIS virtual directory. The default compilation will produce only. aspx files (which may also contain HTML or GIF, and so on) and a bin directory that looks similar to ASP.net 1.0 ( 1.1), but if you delete all of the. aspx files, you will find that the. aspx file that you requested to delete is still able to respond, rather than return a 404 error, because the. aspx file is also compiled and put into the bin directory.
Summarize:
The three new compilation patterns introduced by ASP.net 2.0 make ASP.net's compilation more flexible and user-selectable, vs.net Whidbey also provides powerful smart-prompt support, including new In-line code and runat= Server script quick Smart hint support, all of these are starting to come near ...
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