Asp. NET close-up

Source: Internet
Author: User

The new technology for creating dynamic web pages has been completely rewritten based on the CLR service. So far, all. NET languages can be used to compile ASP. NET pages, but the page extension is different from ASP 3.0. Specifically, the simple Web page uses ". aspx "is the extension, and the Web Service uses". asmx is an extension (derived from "Assembly"), an ASP.. NET page reusable parts to ". aspc "is the extension.

The. NET application can smoothly run the. asp and. aspx pages simultaneously. The old ASP page will be run directly by asp. dll, but it cannot use the CLR function.

Now, the. aspx page does not explain execution, but is compiled into MSIL code when the first call appears, and then runs with intermediate code, just like JSP in J2EE environment. A logical conclusion is that the performance will be improved, and Microsoft claims that it can be comparable to the performance improvement when Visual Basic 4 is upgraded to compiled version 5.

In addition to understanding all the new concepts introduced by VB. NET, these fundamental changes require significant changes to the way ASP pages are written. To understand how to migrate data from ASP to ASP. NET, let's analyze the main changes.

These changes belong to three levels:

API changes
Page Structure Modification
Changes Between VBScript and VB. NET
ASP. NET allows only one language for each page. In DNA, ASP pages can use both JScript and VBScript. However, ASP. NET does not allow this method.

In ASP. NET, functions must be enclosed by HTML <SCRIPT> tags, and functions used to generate HTML code cannot be divided into multiple parts. For example, ASP. NET does not allow the following code:

Instead, we must replace the following code:

<Script language = "VB" runat = server>
Function SayHello ()
Response. Write ("<B> <I> ")
Response. Write ("Hello! ")
Response. Write ("</I> </B> ")
End Function
</SCRIPT>


Brackets that enclose function call parameters are now required. In addition, some compatibility problems may be caused by the fact that all ASP. NET arrays start from 0, while some in ASP 3 Start from 0, and some start from 1.

In VB. NET, parameters are transmitted as values (ByVal) by default. In the current VBScript, parameters are passed as references (ByRef) by default ). Finally, VB. NET no longer supports default values, Set, and Let keywords.

Although these changes are not significant and fundamental, to take advantage of CLR and compile code, you must modify the existing code, which takes a lot of time for developers. Microsoft has announced that tools for code migration will be released along with the. NET platform, but it is helpful to develop appropriate coding habits from now on.

For COM components, ASP. NET will be encapsulated to make the original COM components still run, but these COM components will run outside the CLR managed environment, in addition, switching between managed and non-managed environments sacrifices certain performance. Therefore, many users may decide to rewrite the COM component into COM + 2.0.

ASP. NET introduces server-side controls, which may be an important reason ASP. NET attracts developers to use them. Using these controls, ASP. NET pages can use the following advanced services provided by visual or non-visual controls: TreeView (Tree View), ListBox (list box), Calendar (Calendar), and so on. All these controls analyze the types of customer programs that call them, and then generate appropriate presentation code. Generally, the input box on the Web page uses the client JavaScript to verify the validity of the input. However, if the browser does not support JavaScript or disables JavaScript, the user input verification will be transferred to the server.


Related Article

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.