There is an old project in ASP, but some functions cannot be implemented in ASP, but it is easy to implement in .net, so the title mentioned is the thing.
Because it was the first time I did it, it took me a whole day and took some detours. Let me summarize it now.
Step 1.
Create a new class library project in vs2003, in "Project Properties" - "Configuration Properties" - "Generate", set "Register for COM Interop" to True
Step 2.
Add a class, the file name does not matter
namespace TEST
{
public class dosm
{
....
public string test()
{
return "Hello, world!";
}
}
}
Generate projectStep
3.
Add a new .asp file
<%
set obj=Server.CreateObject("TEST.dosm")
response.write obj.test()
%>
When browsing this .asp file, "Hello, world!" is displayed. The same is true for successful calls and other operations.
Notes:
1. If you want to use this component on other machines, copy the generated .dll file to the corresponding machine, and then register it with "regasm your.dll /codebase". The regasm program is in "%SystemRoot%" Microsoft.NETFramework%FrameworkVersion%" directory.
2. The returned data type may have some restrictions, such as array type, which is not easy to access in vbscript (I haven’t tried it :( ). I wonder if you have any good methods.
3. The called function cannot be a static function, otherwise Will not be found.