. NET Development Platform Research (IV.)

Source: Internet
Author: User
Tags benchmark exception handling execution new set object model range web services visual studio
8. asp.net

Microsoft's asp.net has made significant changes to active Server Page (ASP), not only making it easier for developers to create dynamic Web content, but also making it easier for them to create complex and reliable web applications, such as Web Services. asp.net is Microsoft's. A key part of the net development platform. For Microsoft. NET strategy success, must attract the developer to adopt. NET development platform, including ASP. NET. The ASP. NET Beta testers reported a number of its benefits.

Asp. NET's main goal is to reduce the threshold for Web application development, which has achieved this goal in much the same way as reducing the difficulty of using visual Basic (VB) for Windows programming: Through the design--"event-driven" programming model, where developers fill a form with controls , and then write code to handle events related to these spaces (for example, data entering a text box or clicking a mouse). This also makes it easier to create a service that exchanges data in XML format because developers are allowed to develop them on XML support that is displayed by the. NET Frame class Library.



Asp. In what ways does net complement the. NET development platform?

Asp. NET is a part of the. NET development platform that is used to develop Web applications that reside on Microsoft's Internet Information Server (IIS) and use Internet protocols such as HTTP and soap. Asp. NET makes it easier to develop and deploy two types of Web applications.

· Web Form applications, including two of web pages for dynamic content from scripted web pages and for displaying a UI or form to one client, such as a browser.

· Web Services, for displaying the functionality of other applications and "smart" clients, so that applications can exchange information.

Two Web applications represent a major advantage over traditional applications: they use internet-based protocols to make information easy to move across organizational boundaries (and firewalls) as if they were moving within an organization.

Microsoft previously tried to reduce the threshold for Web application development by using ASP (first introduced as a IIS3.0 extension in 1996). ASP supports VBScript and JScript, as well as some simple objects that can be used for Web application development, such as the Request object, which allows developers to obtain data from the client, and the Response object sends data to the client. With the previous IIS APIs (such as Common Gateway Interface (CGI) (Universal Gateway Interface) and Internet Server application programming Interface (ISAP) (Internet Server Application Programming Interface), ASP is easier to use for Web application development. With ASP, a programmer with HTML and scripting experience can easily develop dynamic Web content.

However, with its limited object model, limited scripting language capabilities, limited tools for end-to-end application debugging, and requirements for API-level calls for external XML tools and analysis programs, it is still difficult to develop a powerful and stable web form.

Passed in. NET development platform, Microsoft asp.net the benefits of the CLR and class libraries to developers. Asp. NET uses the CLR to compile code, manage execution, and create Web applications that run faster and perform better. In addition, ASP. NET uses class libraries to make it easier for developers to incorporate XML-formatted data into a Web application, add code to handle exceptions, create UI elements, and provide additional programming functionality.

















Asp. NET Architecture



Asp. NET enables developers to create Web applications that run on the Internet Information Server (IIS) and. NET development platforms. Asp. NET communicates with IIS through the Internet Server Application programming interfaces (ISAPI), as is the Active Server Pages (ASP). In fact, ASP and asp.net can coexist on the same IIS server: IIS will point the request (with an. asp extension) on the ASP page to the ASP and point the request to the ASP.net page (with an. aspx or. asmx extension) to asp.net.

Asp. NET itself has a cache that improves performance by providing pages that are often used in the cache. Asp. NET also includes a status management service that tracks user sessions. In the ASP, developers often have to create their own cache and state management services to expand the ASP provided.

The. NET Framework Core Development platform supports code in the ASP.net page. In particular, the Common Language Runtime (CLR) compiles and manages the execution of code in the page. The class library provides a uniform set of classes for receiving requests and generating responses (for example, Web Form classes and XML classes).





Asp. NET's Benefits:

Asp. NET offers improvements beyond ASP in three areas: programming models, state management, and from. NET development platform inherits the benefits.

Event-driven programming model

Event-driver programming allows developers to create code that executes once a particular event occurs. For example, in a asp.net scenario, a specific piece of code executes when the control on the page is loaded, unloaded, or clicked. ASP uses a linear code processing model where each ASP code line is doped with static HTML and is processed in the order that it appears in the ASP file.

Event-driven programming makes ASP.net programming closer to Windows programming. The benefit of this is that developers simply write code that responds to events, and they can extend the knowledge of event-driven programming from Windows desktop applications to Web applications.

Another advantage of event-driven programming is that it allows code that processes data to be separated from the code that displays data to the user. For example, ASP. NET allows developers to isolate Web application logic (typically in vb.net or C # development) from the presentation layer (usually in HTML format) using a mechanism called "code-behind." By separating the logic from the presentation, the ASP. NET allows multiple pages to use the same code, making maintenance easier. Developers no longer need to browse HTML representations to modify a programming logic problem, and web designers do not have to read through all the code to fix a page's HTML error (see ASP. NET code-behind "schematic".



Better state management

Asp. NET brings rich benefits to Web application state. State management involves tracking the session data for everyone, which is the unique data generated by the user when interacting with a Web site. For example, the current product information in the user's shopping cart, or whether the user is currently logged on to the site.

Asp. NET solves two problems related to state management. First, state information is often lost if there is a problem with the Web server, and the second is that state information on a Web site that resides on a server group or on a Web field is difficult to manage.

As with ASPs, state information exists in the program in which ASP.net is running. Although this approach provides the best performance, it is also the most lacking in stability and scalability. If the server reboots, the saved state information is lost, and state management in the process is not available to Web applications that reside on multiple servers.

Unlike the ASP, ASP. NET can also use a Windows service (ASPState) for out-of-process state management. Although this is slightly slower than state management in the process, the information can be saved even if the asp.net process is restarted, and it can support Web applications spanning multiple servers across the Web.

Another option for state management is for ASP.net to save state information on SQL Server. This approach ensures that state information is immune to problems on the Web server and allows one SQL Server (the SQL Server cluster on a large site) to save state information for Web applications residing on several servers in the-web Tanaka.



Benefiting from the. NET Framework

Asp. NET makes it easier for developers to create Web pages with a UI using the. NET Framework class Library. The. NET Framework class library provides controls such as text and list boxes, and various buttons, which developers can use by putting labels such as 〈asp:button〉 Insert into their Dynamic Web page to use these controls, or you can use the Visual Studio.NET graphical page editor to add controls. Asp. NET provides the following kinds of controls:

• A server-side version of an existing HTML control, such as a button (HTML button) control that represents 〈input type=submit〉. The main difference between an existing HTML for a form and a asp.net HTML control is the "Runat=server" property, which means that the code runs on the server and the control is displayed on the client.

· Web form controls, which are server-side controls, some are HTML controls, and others are new, more complex controls, such as text boxes (<asp:TextBox>, list boxes, calendars, and data grids). These controls are easier to use than HTML controls, because properties such as capacity are set in a consistent way in all controls.

• Confirm controls, which are controls that link to HTML controls and Web Form input controls, such as text boxes. Confirm that the control can confirm the user's input by comparing, checking the input range, or applying a custom validation code.

All of these controls reduce the number of code developers have to write, the developer simply positions the controls in a page, initializes the control's performance and methods, and then writes code to respond to events that the control might produce, such as the result of some user behavior, such as clicking a button. These controls also support data binding, which makes it easy for developers to associate specific information retrieved from a database with a specified control value.

By contrast, the ASP provides only 6 basic controls. Although ActiveX controls can be used by ASPs, this often weakens the stability of Web applications.

Other than that. NET development platform's class library not only benefits Web applications, but also benefits any Windows applications, which are helpful as follows:

Reduces the encoding of exception handling. Exception handling classes make it easy for developers to add code to handle common programming problems, such as being removed by 0, memory overflows, or files that cannot be found.

Reduced coding for data interchange. By using the class library, ASP. NET developers can easily read and write XML data streams. Asp. NET can also use Ado.net, a new set of extended active data Objects (ADO) to manage connections to data in a database and process data.

Improved performance. Asp. NET performance is much better than ASP, mainly because the CLR-targeted code is compiled and executed, while the scripting language for ASP is interpreted. When code is used for the first time, it may be slower to start page addition, but in subsequent page requests, the page will be read from the compiled code in the dynamic output cache. When a control event or query string that identifies a cached page changes, the ASP. NET can even be dedicated to caching. Even the ASP.net beta appears to be much faster than the ASP. (Microsoft offers a comparison, see ASP.) NET Performance ". )

Increased language support. Asp. NET allows developers to use any language supported by the CLR, including VB.net and C #. ASP only supports an interpreted script description language such as VBScript and JScript.

Improved debugging support. Developers of ASP.net Web applications can either use the debugger contained in the. NET Framework SDK or use the debugger integrated in Visual Studio. In addition to allowing developers to step through the code and set breakpoints, the ASP. NET also supports tracing, which allows developers to track the execution of an application and then observe the results of the trace. To troubleshoot an ASP page, developers have to scatter code with custom "Response.Write" declarations to display variable values for specific points in the application. After debugging, you must clear or annotate the lines of code so that when the application runs as a product, debugging information is not output. You can easily set up tracing on or off, and you can work with a single Web page and a wide range of Web applications.





Asp. NET performance



Data is a benchmark based on Doculab Nile, which is often used to evaluate the performance of application servers. Implementing ASP.net's Nile benchmark requires 4,000 C # code to generate a mix of ad-hoc searches, create new customers, manage shopping carts, and process orders. Keep the hardware configuration unchanged, and by testing the application and database servers, the results are as follows: Additional tests show that there is little difference between writing code with vb.net and writing code in C #.





to asp.net:

The difference between ASP and asp.net makes it impossible for ASP pages to run on asp.net. However, a single IIS server can host both ASP applications and web-based Web applications based on ASP.net.

Developers who want to take advantage of ASP.net have several options:

• Keep existing ASP applications in place and develop new applications on asp.net. Because ASPs and asp.net can coexist, there is no need to urgently convert existing applications to asp.net, but knowing ASP.net's significant advantages, developers may no longer want to develop any new ASP applications.

• Add ASP.net features to an existing ASP Web application. In principle, developers can build with ASP and ASP. NET mixed-page application, which allows applications to migrate to ASP.net. However, state management cannot be separated from the ASP and ASP.net, which makes this approach impractical if state information must be shared between ASP and ASP.net pages.

• Convert existing ASP Web applications to asp.net. This requires developers to convert existing script-based code to vb.net or C #, from ADO to Ado.net, and to add event-driven code to the application. Examining existing applications carefully, determining how much of the scripting code is embedded in the page, and examining the new advantages of asp.net, such as server-side controls and event models, will show whether this approach is meaningful.

• Use existing pages as a validation specification, take advantage of ASP.net features, reconstruct the presentation and logic of the page, and overwrite existing ASP Web applications for asp.net. This method may take the most effort, but it may be the best in terms of application stability and performance.


Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.