Using VB ActiveX.dll files in ASP

Source: Internet
Author: User
Tags object model
No one will work in a more troublesome way without necessary, unless there is no room for choice. So if I'm going to tell you that there is a simple technology that can make your ASP development faster and more efficient, you must be particularly interested in this. This approach will move from most of the business logic in your ASP page to a visual Basic ActiveX. dll to improve the performance of the entire Web page.
Reason for using ActiveX. dll

Creating a. dll file in Visual Basic is actually an ActiveX object. This object can be implemented using Microsoft's Component Object Model (COM) technology, and you can use them to create classes related to. dll.
Developers use. dll for a number of reasons, and each project does not contain all the benefits. However, once you take this approach, you will find that you are using ActiveX. DLL technology. Now let's take a look at the advantages of using ActiveX. DLL technology.
Better performance
Without any doubt, one of the main concerns of a developer is complete performance. An ActiveX. dll runs faster than a normal ASP page. Let's take a look at a simple example. An ASP page calculates a variable from 0 to 10000000 and then displays a "done" string that takes 26,087 milliseconds. However, the VB.dll file takes only 100 milliseconds to complete the process. So VB.dll is 260 times times faster than the ASP page.
In such tests, the speed difference is obvious because the ASP runs for 26 seconds and the. dll only needs to run less than 1 seconds. Keep in mind that the difference in speed is primarily related to the amount of work that your code is dealing with, that is, the greater the effort the code performs, the more obvious the difference in speed. If the above test file is enlarged by one time, the speed difference will be more pronounced. ASP pages take 25,156 milliseconds, whereas. dll only takes 70 milliseconds-the latter runs at 359 times times the speed.
A. dll can run faster than an ASP page for two reasons:
. dll is compiled. This means that the file runs in the machine language, which is the speed at which it can be achieved. The ASP page runs code that is processed by a script engine, so that each part must be compiled before being processed.
. dll uses a variable that is declared as a Long data type, which does not require an explanation of the 32-bit processor. The script page uses a Variant variable that must be converted to a number before it can be used in the calculation, which inevitably increases processing time.
Variable declaration method is better

Variable declaration methods can make running faster, in addition to more easily program development, because the variable type does not need to convert. Variables can be declared in the initial state, avoiding the writing of additional conversion code lines.
Source code is hidden
A. dll file can keep your source code hidden from some hacker attacks. An ASP page stores the script in plain text to your Web server. Once someone gets access to your Web site files, the Web page is easily accessible, so your source code is exposed and compromised. Use an ordinary ActiveX. dll file to handle the business logic of your site, thereby preventing malicious people from accessing your source code.
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.