Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Abstract This article mainly introduces how to use VB to encapsulate ASP code into DLL to protect ASP code, speed up ASP code execution, and save server resources.
Keywords ASP, DLL, programming
Server-side script running environment, which is easy to use and does not require compilation and connection. Scripts can be run directly on the Server side. It supports multiple users and multithreading and has been widely used in Web development. The server component is different from the client component. The client components are transmitted over the network and work with HTML, and can only be used on IE. However, the server component runs on the server and performs various operations on the server. Therefore, all browsers can enjoy it, relying on servers rather than browsers. However, because ASP scripts are in plain text format, attackers can easily see the page content they should not have seen through the source code. Therefore, it is very important to protect the ASP Source Code. Encapsulating ASP code into DLL not only speeds up ASP code execution, but also protects the original code. When IIS is requested to execute an ASP program, it first finds the code between the labels in the ASP file, and execute it (it can also be the code between <script runat = server> </script> ). If this ASP program was previously called, it will return HTML code to the user using the compiled program in the memory. If not, it will be re-compiled. This greatly saves the server resources.
II. Implementation method
Start your VB and select the ActiveX icon. This icon can be found in the new project! VB provides a default project name (project1) and class name (class1 ). Before you start, make sure that we have Microsoft ActiveX Data Object 2.0 Library, which is very useful in our program. Select "project" from the menu, and then select "reference". The "reference" window appears, from which Microsoft ActiveX Data Object 2.0 Library is selected.
Now we have our own project (project1) and class name (class1 ). In the future, we will use their names in ASP code to reference this component. In ASP, we reference it as follows:
Set ObjReference = Server. CreateObject ("ProjectName. ClassName ")
To use ASP methods in a class, you must write the initial and termination functions in this class. Enter the following code: Private Sub Class_Initialize () and Private Sub Class_Terminate () in Class1.cls in the program list ().
Make the key functions in ASP code into a dynamic link library (. dll) to partially hide the ASP Source Code.
For example, the code entered in Global. bas and Class1.cls in the program list (the main function of the code is to retrieve and display records in the database ).
In the VB drop-down menu, select File → generate article. dll → select the directory to save. Find article. dll and copy it to the system32 folder on the system disk. Register the DLL file in the last step. In the Start menu, select run enter regsvr32 c: winntsystem32article. dll.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.