在asp中调用.net 2.0生成的dll

来源:互联网 发布:诲女知之乎的女拼音 编辑:程序博客网 时间:2024/05/19 09:14

、创建.Net 2.0的DLL,示例代码如下
using System;
using System.Collections.Generic;
using System.Text;

namespace Test
{
    public class Test
    {
  
        public Test()
        {
        }

        public string SayHello(string fInput)
        {
            return "HELLO " + fInput;
        }
    }
}

2、注册dll为com组件
(1)右键单击工程--》属性--》应用程序--》点击程序集信息--》最下面的复选框(使程序集Com可见)
(2)复制DLL到系统目录/SYSTEM32/下
(3)使用regasm注册DLL

3、在asp中调用DLL,文件名为TEST.ASP,代码如下
<%
set test = Server.CreateObject("Test.Test")
response.write test.SayHello("wichian")
set test = nothing
%>


原创粉丝点击