Use. Net to Develop ASP Components

Source: Internet
Author: User

 

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.

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.