The user control in ASPX is compared to the INCLUDE method in ASP

  • 2020-05-05 11:08:59
  • OfStack

      in ASP s, in order to avoid the frequent repetitive labor, or code similar to some function area, often make a file, and then through the connection (direct connection or a virtual connection) method is introduced into the ASP web document, for a big cites many ASP file is equivalent to a file is divided into many blocks, each other can be free to share files between data (in addition to the function of data).
With INCLUDE       ASPX user control are very different, the biggest characteristic of it is that he is present in the form of packaged objects, through our programming, can be a common example of abstracting, some functions and methods summed up and made the corresponding function calls, and attribute for external events completely generalization, the greatest degree of encapsulation of outer user does not need to know about the internal facts, makes it more maintainable, also improved the security of the data, more conducive to the release of the program.
      Simple to use, but can also function is relatively small, or it is not perfect, we can be free to a file containing the specified ASP file, however, because of each other's data can be Shared, so lead to the interdependence between the file is very high, reduces the code readability, does not favor the system maintenance, at the same time, if the INCLUDE file if there is a picture, and contained files and need to include the files are not under the same directory, address contained the picture of the file must have a need to include the file to display images can address shall prevail, As/FILE INDEX ASP is a master file (need include file file), and/FILE INCLUDE/TITLE ASP is contained files, pictures and address for/file/title jpg right now you need to TITLE. ASP images from the address is changed to title. jpg instead.. / title.jpg, otherwise you will not be able to display the image in the main file       complex ASPX is solved many problems, such as that in the control file set the picture address of freedom, he should ignore reference file directory under the what, as long as the control file that can be displayed, still can be used after being quoted, this allows the user to make the control more reusability, as opposed to ASP, for different directory files refer to the same function when you need to set up two but in fact the same images or hyperlink addresses different files. Waste of resources, Of course, these advantages also make it difficult to write files, and require higher induction ability for analysis, so that the control can be more widely used.


Related articles: