.NET development platform research (4)

zhaozj2021-02-16  54

8. ASP.NET

Microsoft's ASP.NET has made great changes to Active Server Page (ASP) not only make developers easier to create dynamic web content, but also make them easier to create complex and reliable web applications, such as Web Services. ASP.NET is a key part of the NET development platform. For the success of Microsoft .Net strategy, it is necessary to attract developers. NET development platform, including ASP .NET. The ASP .NET Beta version of the tester reports its great benefits.

ASP. NET's main goal is to reduce the threshold for web application development, which implements this goal with a process of reducing Windows programming difficulty using Visual Basic (VB): through design - "Event-Drive" programming model, In this model, the developer fills the control to a form and then writes the code processing related events related to these spatial (for example, data into the text box or click the mouse). Since the developer is allowed to be developed on XML supported by the .NET Frame class library, this also makes them easier to create a service that exchanges data in XML format.

What are the ASP.NET supplemented ?NET development platform?

ASP.NET is a component of the .NET development platform to develop a web application that resides on Microsoft Internet Information Server (IIS) and uses Internet protocols such as HTTP and SOAP. ASP.NET makes two types of web applications easier.

• Web form application, including web pages generated from scripts for dynamic content, and two web pages to a customer (eg, browser) displaying a UI or form.

· Web Services, used to display other applications and "smart" clients, enable applications to exchange information.

Two web applications reflect a major advantage that exceeds traditional applications: they use Internet-based protocols to easily pass through the tissue boundary (and firewall), as in one organization.

Microsoft actually tried to use ASP (1996 as IIS3.0 extension feature first introduced) to reduce the threshold for web application development. ASP supports VBScript and JScript, and some simple objects available for web applications, such as request objects, allowing developers to get data from the client; Response objects send data to the client. As previously IIS APIs, such as Common Gateway Interface (General Gateway Interface), and Internet Server Application Programming Interface (ISAP) (ISAP) (Internet Server Application Programming Interface)), ASP is easier to use for web applications. Using ASP, a programmer with HTML and script experiences can easily develop dynamic web content.

Despite this, in its limited object model, limited script description language capability, limited tool for end-to-end application debugging, and the requirements for the external XML tool and analyzer for API level call, develop a powerful And the stable web form is still very difficult.

By embedding ASP.NET in the .NET development platform, Microsoft provides the benefits of CLR and class libraries to developers. ASP.NET uses CLR to compile code, manage execution, created a web application that runs faster and better performance. In addition, ASP.NET uses class libraries to make developers more easily merged into the web application, add processing exception, create a UI element, and provide other programming functions. ASP.NET architecture

ASP.NET enables developers to create web applications running on Internet Information Server (IIS) and .NET development platforms. ASP.NET is also available in Active Server Pages (ASP) through Internet Server Application Programming Interfaces (ISAPI) with IIS. In fact, ASP and ASP.NET can coexist on the same IIS server: IIS will point to ASP for ASP pages (with .asp extensions), requests for ASP.NET pages (with .aspx or. ASMX extension) Points ASP.NET.

ASP.NET itself has a cache that improves performance by providing frequently used pages within Cache. ASP.NET also includes a status management service that tracks the user session. In ASP, developers often have to create their own cache and status management services to expand the ASP.

The .NET Framework Core Development Platform supports code in the ASP.NET page. In particular, Common Language Runtime (CLR) is compiled and executed in the management page. The class library provides a unified class set (such as web form classes and XML classes) for receiving requests and generating responses.

Benefits of ASP.NET:

ASP.NET provides improvements to ASP in three areas: programming model, status management, and benefits from .NET development platform.

Event - Drive Programming Model

Event - Drive Programming allows developers to create code that is executed once a specific event occurs. For example, in the case of ASP.NET, when loading, uninstalling or clicking on the control on the page, a specific code will execute. ASP uses a linear code processing model, each ASP code line is doped with static HTML, and is processed in the order in which it appears in the ASP file.

Event - Drive Programming makes ASP.NET programming closer to Windows programming. The benefits of doing this are that developers only need to write a response event, and they can extend event-driver programming knowledge from the Windows desktop application to web applications.

Another advantage of an event-driver programming is that it can separate the code of the processing data to the code to display the data to the user. For example, ASP.NET allows developers to use a mechanism called "code hidden" to separate web applications logic (usually with VB.NET or C # development) from the representation layer (usually in HTML format). By separating logic with representations, ASP.NET allows multiple pages to use the same code, so that maintenance is easier. Developers no longer need to browse HTML in order to modify a programming logic issue, the web designer does not have to read all code to correct a page's HTML error, (see "ASP.NET code hide" diagram).

Better state management

ASP.NET gives a rich benefits to the Web application status. Status management involves tracking the session data of each person, which is a unique data generated when the user interacts with the Web site. For example, the user's shopping cart is current product information, or whether the user is currently logged in to the site.

ASP.NET solves two problems related to status management. The first, if the web server is problematic, status information is often lost; the second, the status information on the Web site on a server group or web site is difficult to manage. Like ASP, status information exists in the program where ASP.NET is running. Although this approach provides the best performance, but also the most stability and scalability. If the server restarts, the saved status information will be lost, and the status management in the process cannot be provided to a web application that resides in multiple servers.

Unlike ASPs, ASP.NET can also use a Windows Service (ASPState) for process-proof state management. Although this is slightly slower than the status management in the process, even if the ASP.NET process is restarted, the information can still be saved, and it can also support web applications across multiple servers in WEB fields.

Another status management selection is to allow ASP.NET to save status information on SQL Server. This way ensures that status information can be spared from issues on the web server and allow a SQL Server (SQL Server cluster on the big site) to save status information on several servers on the -Web field.

Benefits from .NET Framework

ASP.NET makes developers to create a Web page with the UI with the .NET Framework class library easier. The .NET Framework class library provides controls such as text and list boxes, as well as various buttons, and developers can use these controls by inserting tags (such as into their dynamic web page, or can also use The Visual Studio.net graphic page editor is added to the control. ASP.NET provides the following types of controls:

· The server-side version of the existing HTML control, such as the button (HTML Button) control representing . The existing HTML and ASP.NET HTML controls of the form is the "Runat = Server" property, which represents the code runs on the server, and the control is displayed on the client.

· Web form control, this is a server-side control, some are HTML controls, and some are more complex controls such as text boxes (, list box, calendar and data grid, etc. Controls are easier to use than HTML controls because properties such as capacity are set in all controls in all controls.

· Confirm the control, which is a control that links to the HTML control and web form input control (e.g., text box). Confirmation control can confirm the user's input by comparing, checking an input range or applying a custom confirmation code.

All of these controls reduce the number of codes that developers have to write, and developers simply position controls in a page, initialize the performance and method of the control, and write code to respond to events possible events, this event is The result of certain behaviors (such as click on the button). These controls also support data binding, which makes the developer easily associate specific information retrieved from the database with the specified to the control value.

In contrast, ASP only provides 6 basic controls. Although the ActiveX control can be used by ASP, this usually weakens the stability of the web application.

In addition, the .NET development platform class library not only benefits the web application, but also benefit from any Windows applications, which helps:

Reduce the encoding of abnormal processing. Abnormal processing classes make developers can easily add code to process public programming issues, such as except, memory overflow, or find files.

Reduces encoding for data exchange. By using the class library, ASP.NET developers can easily read and write XML data streams. ASP.NET also uses ADO.NET, a new set of extended Active Data Objects (ADOs) (active data objects) to manage connections to data in the database and process data. Improved performance. ASP.NET performance is greatly better than ASP, mainly because code is compiled with CLR's target, while the scripting language for ASP is explained. When the code is used for the first time, it is to be compiled, and the start page can be planted slowly, but in the subsequent page request, the page reads the compiled code in the dynamic output cache. When you identify control events or query strings of the cache page, ASP.NET can even dedicate. Even the ASP.NET beta version seems to be much better than the ASP. (Microsoft provides comparison, see "ASP.NET Performance".)

Added language support. ASP.NET allows developers to use any languages ​​supported by CLR, including VB.NET and C #. ASP only supports the interpreted script description language of VBScript and JScript.

Improved debugging support. ASP.NET-based web application developers can use debuggers included in the .NET Framework SDK, or using debuggers integrated in Visual Studio. In addition to allowing developers to gradually check the code, set the breakpoints, ASP.NET also supports tracking, which allows developers to track an application execution and then observe the tracking results. To troubleshoot the ASP page, developers have to spread the code with custom "response.write" declarations to display variable values ​​for specific points in the application. After debugging, these code lines must be cleared or commented so that the debugging information will not be output when the application is running as a product. You can easily set up or off, and you can work with a separate web page can also work with a wide range of web applications.

ASP.NET performance

Data is based on Doculab's reference, which is often used to evaluate the performance of the application server. Realization ASP.NET NILE reference requires 4,000 C # code to generate a mixture of Ad-Hoc search, create new customers, manage shopping carts, and handling orders. Keep the hardware configuration unchanged, through the test of the application and database server, draw the following results: Additional tests indicate that the code is written in VB.NET and the code code is not large.

Removal to ASP.NET:

The difference between ASP and ASP.NET causes an ASP page that cannot be run on ASP.NET. However, a single IIS server can also resident ASP applications and ASP.NET-based web applications.

There are several options to use ASP.NET developers:

· Reserved existing ASP applications, develop new applications on ASP.NET. Because ASP and ASP.NET can coexist, it is not necessary to move existing applications to ASP.NET, but know the significant advantage of ASP.NET, developers may not want to develop any new ASP applications. .

• Add the ASP.NET feature to an existing ASP web application. As in principle, developers can establish an application with ASP and ASP.NET hybrid pages, which enables applications to be movable to ASP.NET. However, status management cannot be separated between ASP and ASP.NET, if status information must be shared by the ASP and ASP.NET pages, which makes this method unrealistic.

· Convert existing ASP web applications to ASP.NET. This requires developers to convert existing script-based code to VB.NET or C #, converted from ADO to ADO.NET, and add event driver code to the application. Carefully check existing applications, determine how many script code is embedded in the page, and examine the new advantages of ASP.NET, such as server-side controls and event models, will indicate whether this method is meaningful. · Using the existing page as the specification of the verification, take advantage of the ASP.NET function, rebuild the representation and logic of the page, and write

current

ASP Web

Application makes it for

ASP.NET

. This method can take up to the company, but the best effects may be achieved in terms of application's stability and performance.

转载请注明原文地址:https://www.9cbs.com/read-22644.html

New Post(0)