In the ASP era, in order to avoid repeated work, some areas or codes with similar functions were often made into a file and then introduced into the ASP web page file through a connection (direct connection or virtual connection). For a Largely referencing many ASP files is equivalent to a file being divided into many blocks, and data between files can be freely shared (except for data in functions).
ASPX user control is very different from INCLUDE. Its biggest feature is that it is presented in the form of a packaged object. Through our programming, a common instance can be abstracted and some functions and methods can be abstracted. To sum up, create corresponding functions and attributes for external event calls to achieve complete classification and encapsulate internal facts that outer users do not need to know to the greatest extent, making it more maintainable and improving data security. , more conducive to program release.
Simple things are easy to use, but naturally they have fewer functions or are very imperfect. We can freely include a certain file into the specified ASP file, but since each other's data can be shared, As a result, the interdependence of files is very high, which reduces the readability of the code and is not conducive to system maintenance. At the same time, if there is an image in the file being included, and the included file is not in the same file as the file that needs to be included. When under the directory, the address of the image of the included file must be based on the address where the image can be displayed in the file that needs to be included. For example, /FILE/INDEX.ASP is the main file (the file that needs to be included), and /FILE /INCLUDE/TITLE.ASP is an included file, and the image address is /file/title.jpg. At this time, you need to change the image address in TITLE.ASP to title.jpg instead of ../title.jpg, otherwise it will not work. Displaying pictures and hyperlinks in the main file also has the same problem.
The complex ASPX certainly solves many problems. For example, you can freely set the address of the image in the control file, regardless of the directory in which the file that references it is located. As long as it can be displayed in the control file, it will still be displayed after being referenced. can be used, which makes user-made controls more reusable, unlike in ASP, where when files in different directories reference files with the same function, two addresses that are actually the same but have pictures or hyperlinks need to be set. Different files waste resources and make maintenance costs higher. Of course, these advantages also make it more troublesome to write files. It requires higher induction capabilities for analysis, so that the control can be used more widely.