ASP allows for the use of external DLLs for your web applications. The DLL that you integrate generally includes code that was compiled in either VB, or C++. The ability to introduce external code into your web application is useful
in scenarios where certain functionality is needed in your application and someone has already written the code that you need. Once you introduce the DLL into your web application, you will be able to create instances of the objects
defined in the DLL so that you can access the properties and methods of the objects of interest.
Register the DLL
Prior to accessing the objects that reside in the DLL file, you must first register the DLL with the Windows Runtime Library.
Register via regsvr32
- Place the DLL file AspEmail.dll in a directory on the server, note the path for step 2
- Register it using the regsvr32 command-line utility: c:\>regsvr32 myDLL.dll
- If you receive a confirmation message that the process has been completed, no other steps are required.
Unregister via regsvr32
- Unregister it using the regsvr32 command-line utility: c:\>regsvr32 /u myDLL.dll
- The DLL file is not required so you can safely delete it from the file system.
Using the DLL in your Application
After you have registered the DLL with the operating system, the next step is to access the procedures that are contained within it. In this example, the DLL that was registered is called myDLL.dll. Within the DLL, there is a class called
myClass. To create an instance of this class you would use the Server.CreateObject method as follows:
myObj = Server.CreateObject("myDLL.myClass")
myObj = nothing
Recommended Books & Training Resources