The .NET's DLL is no longer a dynamic connection library in strict sense, but a class or class library. It cannot be used directly in other applications such as ASP, VB. We can package the .NET's DLL again through the COM CALLABLE WRAPPER (CCW) to achieve the corresponding functionality through this intermediate medium.
The following is a small example for your reference. 1. Create a Class project in .NET Visual Studio. 2. Add a class in the project, the code is as follows:
Using system;
Namespace classlibrary1 {
/ / Define the interface, this is important (the method in this interface is consistent with the method in the COM component) public interface ics1 {
String test ();
}
Public class class1: iClass1 {private string t = ""; // Implement the method in the interface public string test () {return "ok";}}}}
3. In the .NET command line window, create a key pair. You can use the .NET itself: sn.exe to create a key pair. Such as: Sn -k testdll.keys 4. Create a strong name assembly in the assemblyInfo.cs file, add [Assembly: askEMBLYKEYFILE (@ "c: /test.keys") attribute 5. Compiling the entire project Generate ClassLibrary1.dll (This DLL can be found in the / bin / debug path.) 6. In the .net command line window, generate the type library TLBEXP ClassLibrary1.dll /out: Classlibrary1.tlb
7. In the .NET command line window, registered accessories regaSM /TLB: ClassLibrary1.tlb classlibrary1.dll
8. In the .NET command line window, install the .NET assembly to the global assembly cache (GAC) Gacutil / i classlibrary1.dll 9. Test <% SET S = CreateObject ("Classlibrary1.class1" in ASP ("ClassLibrary1.class1") Response.write (S.Test ())%>