Overview
ASP is now rebuilt from the beginning to the end. The result is ASP. NET. It is not just ASP 4.0, it is a new framework for Web development, which contains many new features. ASP. NET provides code that is easier to write and clearer in structure, which can be easily reused and shared. ASP. NET uses compiled languages to improve performance and scalability. ASP. NET uses Web forms to make development more intuitive, and uses object-oriented technology to promote reuse of components. In addition, ASP. NET also includes page events, Web controls, buffering technology, server controls, and data bundle improvements. The libraries for ASP. NET and the Microsoft. NET Framework allow users to use commercial functions through the Web, providing more new development opportunities for programmers.
Advantages of ASP. NET
ASP. NET makes the code clean. In existing ASP applications, no matter how you write them, the structure is always full of long and short code. ASP. NET code is not only easier to write, but also more clean and tidy, and easier to read than ASP code. At the same time, the structure of ASP. NET Code improves reuse and sharing.
ASP. NET improves configuration, scalability, security, and reliability. For simple ASP applications, configuration is not a problem, but you will encounter problems when porting to a N-layer structure using components. When you configure and maintain these applications, DLL traps (Component registration, version, locked DLL, and so on) will occur. In ASP. NET, the component registration and DLL lock are canceled, and the XML configuration file is fully used to solve this problem. In this way, you only need to copy files to configure a Web application.
ASP. NET provides better support for different browsers. For ASP developers, browser compatibility is always a problem. You can write code for a lower-level browser, such as HTML 3.2, or restrict the browsing range of the page. The introduction of wireless application protocol WAP devices will also deepen this problem. This section describes how ASP. NET solves browser compatibility issues.
ASP. NET has created a new type of Web application. Currently, Web applications are usually in the same pattern: a set of linear applications, and then the logic is embedded into one of them. ASP. NET allows developers to break this single model and create more dynamic and scalable applications that can better meet the company's business needs and provide a richer development environment.
At this point, you may think that although these goals are noble, they will make it difficult to write applications. On the contrary, it is much easier to use ASP. NET for development!
Next, let's take a closer look at the powerful features of ASP. NET, including:
● Compilation language support
● Web forms
● Page events that follow page objects
● Web Control
● Web Services
● Buffer technology
● Debugging and tracking
● Code and content isolation
● Common namespace Library
● Configuration
Use compiled languages
The existing ASP versions are based on script languages, such as VBScript and JScript. There are no mistakes in the scripting language itself, but they have two major flaws: they are interpreted and are not strictly classified. ASP. NET does not completely abandon the concept of scripting language. It introduces support for fully compiled languages, so that you can use Visual Basic to write your own server-side code, for example:
<Script language = "vb" runat = "server">
One of the major advantages of Visual Basic is its support for strictly classified variables. Therefore, the following code is established in ASP. NET:
Dim FirstName As String
In addition to Visual Basic and C ++, you can use the latest Microsoft Language C # To write server-side code. C # It is easier to understand and remove the useless parts of C ++. With ASP. NET, the compilation action occurs when the page is loaded for the first time. Even if the code is a scripting language, it will be compiled before execution, so the performance of the Jscript code page will be improved. In fact, this is a basic new feature of the. NET Framework. In earlier versions, the language compiler treats data types and objects differently, which means that the only cross-language development that can be performed is the creation of COM objects. Microsoft. in the. NET Framework, the general language runtime environment CLR allows for close interaction with any code that has been compiled using the general runtime, this is what the New Visual Basic and C # compilers will do: create code that can be managed during runtime.
The biggest advantage of doing so is to make real cross-language development possible. With the general runtime environment CLR, you can use C # To create objects and extend them through the inheritance function in Visual Basic. Currently, Visual Basic. NET supports inheritance, so that you can write components in C # and set them to subsets in Visual Basic. Although Visual Basic, C #, and scripting languages are supported in the initial framework structure, other languages, such as Smalltalk, Eiffel, and Pascal, will be supported later. One advantage of the Microsoft. NET Framework is that it is very easy to scale. Therefore, to use a new language, you only need to provide compiler support for output compatible with the runtime environment.