Comparison between the user control in aspx and the include method in ASP

Source: Internet
Author: User

In the ASP era, in order to avoid repeated work, a file is often made for areas or codes with similar functions, and then connected (directly connected or virtual) the method is introduced into the ASP Webpage file. For a large referenced ASP file, it is equivalent that a file is divided into many blocks, data between files can be freely shared (except for data in functions ).
The user control of ASPX is very different from that of INCLUDE. The biggest feature of ASPX is that it is presented in the form of encapsulated objects. Through our programming, A common example can be abstracted, and some functions and methods can be summed up to form corresponding functions and properties for external event calls, so as to implement full classization, it encapsulates the internal facts that outer users do not need to know to the greatest extent, making them more maintainability, improving data security, and facilitating program release.
Simple things are easy to use, but naturally there are few functions, or they are not perfect. We can freely include a file into a specified ASP file. However, because the data of each other can be shared, the file dependency is high, which reduces the code readability and is not conducive to system maintenance. At the same time, if there is an image in the file to be included and the file to be included is not in the same directory, the image address of the included FILE must be the address of the image displayed in the FILE to be included, such as/FILE/INDEX. ASP is the main FILE (the FILE that needs to contain the FILE), And/FILE/INCLUDE/TITLE. ASP is an included file, and the image address in title.aspis changed to title.jpg instead .. /title.jpg. Otherwise, the image cannot be displayed in the main file, and the hyperlink is the same.
Complex ASPX solves many problems. For example, you can freely set the image address in the control file, so you don't have to worry about the directory under which the file is referenced, as long as the items that can be displayed in the control file can still be used after being referenced, this makes the controls made by users more reusable, unlike ASP, when files under different directories reference files with the same function, you need to set two files with actually the same but different image or hyperlink addresses. resources are wasted, and maintenance costs are higher. of course, these advantages also make file writing more troublesome, and have higher requirements on analysis, making the control more widely used.

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.