June 2000 Microsoft issued the .NET program, the programming work has caused a epoch-making revolution in the industry. ASP.NET is an important part of the .NET plan that provides many new features for web application developers, including compiled server-side code, one separated by server-side logic with client layout Code-behind technology, scalable server-side control model, design data binding model, XCopy deployment, and form ID card authentication support on customers and servers.
Asp.net is an advanced web application development technology that has revolutionary progress relative to the ASP. It uses the compiled language (including resources such as metadata, IL), which is a major reason why .aspx files have greatly improved, and ASP.NET is different from previous ASPs. ASP.NET's first load page is slow, but the speed of loading this page will be ASP can't match, and its speed is fast. This is because ASP.NET requires overhead when accessing the web page: Load the ASP.NET worker process, analyzing the .aspx file syntax, compiles it into an executable assembly. This is different from the ASP engine executive server code because the ASP always hands the server code to the JScript or VBScript interpreter each time.
ASP.NET is not known as ASP 4.0, but in many ways, it is the ASP version 4.0. We can see the similarities of the .aspx file from the two examples below:
Routine 1: ASPX page example
<% @ Page Language = 'C #'%>
Int Add (int x, int y)
{
Return X Y;
}
script>
Two numbers: td>
<% = add (2, 3)%> td>
TR>
TABLE>
body>
html>
Roller 2: ASP page example
<% @ Language = jscript%>
Function add (x, y)
{
Return X Y;
}
script>
Two numbers: td>
<% = add (2, 3)%> td>
TR>
TABLE>
body>
html>
The code in html> above the above two routines is the same, and the language is used by <%%> declaration. Both of the code run in the server side, but when accessing these two files, the things that have happened behind it is very different. Let's analyze the running mechanism of the Test.asp file. When performing a Test.asp file, the server is linearly parsed in the text in the web page, extracts all the contents of the server-side script and returns to the response, and the server side in the web page Script (We joined the runat = server attribute in the script of the Test.asp file) First, the execution result is returned by the JScript interpreter. Therefore, the operation mechanism of .asp file affects web generation in several ways (that is, what we usually said) is slow. Several aspects affecting. SASP web page efficiency is: First, the random interpretation server-side script is lower than the code efficiency of executing the precompiled code on the server, so the ASP application is optimized, and the general method is to make a large number of servers. The end script is moved into the pre-compiled COM component so that the response speed of the web page can be effectively improved; the first aspect is, since the interpreter is constantly calling the interpreter, mixing the static HTML and server-side quotient statement script block ratio only With a server-side script, the efficiency of this block is lower, so in order to improve the performance efficiency of the application, some ASP developers typically use Response.Write () to replace static HTML elements. Finally, a variety of scripting languages on an ASP page have been used to greatly reduce the performance efficiency of the application. Now, let's analyze the running mechanism of the Test.aspx file, in this example, use the C # language to write the script, so compile these code into a kind of IL assembly language using the corresponding CLR using the corresponding CLR to use the corresponding CLR to be called IL assembly language and saved to The program is concentrated. Using CLR, no matter what language (C #, VB.NET, JScript, etc.) written, it is ultimately compiled into IL assembly language. The generation process of the assembly is shown below: It can be seen by the above figure, the program set includes both the server-side code and the static HTML statement, so as long as the first visit has been accessed, when the page is generated in the future Simply perform the compiled code. The ASP.NET page is ultimately compiled into a .NET class (component is also called class), so it is impossible to use a variety of server-side languages in one .aspx file, which solves the traditional ASP script model. All related issues of efficiency. So, ASP.NET is an upgrade version of ASP.
Compared with the interpretation model, there are other benefits of using the compilation model: 1. Compiling the model in terms of performance. Because the compiler compiles web pages into classes (components) so that you can debug with the same debugging tools used by desktop applications or component developers. 2. Easy to make an application can find errors when compiling so that the robustness of the application is greatly enhanced. 3, .NET application developers can use all tools, .aspx developers can also be used. All in all, from traditional ASPs to ASP.NET, is a revolutionary improvement in the performance, speed and other aspects of the program.