There is an old project that is ASP, but some functions cannot be implemented on ASP, which is very easy to implement in. net, so the title is described as a matter.
Because it was the first time, it took a whole day and took some detours. Now I will summarize it.
Step 1.
Create a new class library project in vs2003. In "Project Properties"-"configuration properties"-"generate", set "com InterOP registration" to true.
Step 2.
Adding a class does not matter the file name
Namespace Test
{
Public class dosm
{
....
Public String test ()
{
Return "Hello, world! ";
}
}
}
Generate a project
Step 3.
Add a new. asp file
<%
Set OBJ = server. Createobject ("test. dosm ")
Response. Write obj. Test ()
%>
"Hello, world!" is displayed when you browse this. asp file! ", Called successfully
Other operations are similar.
Note:
1. if you want to use this component on another machine. copy the DLL file to the corresponding machine, and then use "regasm your. dll/codebase "to register, regasmProgramIn the "% SystemRoot % \ Microsoft. NET \ framework \ % frameworkversion %" directory.
2. The returned data type may have some restrictions, such as the array type. In VBScript, it is not very easy to access (I did not try it out). I don't know if you have any good methods.
3. The called function cannot be a static function; otherwise, it cannot be found.