[转]使用ASP调用C#写的COM组件
转自: http://www.cnblogs.com/rentj1/archive/2009/02/23/1396187.html
1 新建类库MyTestDLL
2 右击项目“MyTestDLL”-》属性-》生成-》勾选“为COM互操作注册”
3 打开 AssemblyInfo.cs 文件 修改 [assembly: ComVisible(true)]
4 打开Visual Sutdio 2008 的命令提示行工具输入guidgen.exe 选择DEFINE_GUID 单击 "New GUID"
5代码
1、每个类名对应一个接口名,接口名是类名前加上一个大写的I
2、接口中声明的方法要使用属性 [DispId(n)]
3、类必须有一个无参构造函数
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MyTestDll
{
// 这里Guid为第4步生成的。
[Guid("FFA4B191-FB5B-4dd5-B7B1-B2F32BF6F1FF")]
public interface IMyTestDll
{
[DispId(0)]
string GetAbout();
}
public class Test1:IMyTestDll
{
private string summary;
public Test1()
{
summary = "这是我的第一个测试";
}
public string GetAbout()
{
return summary;
}
}
}
6 生成项目
ASP测试代码
<%
Dim o &nbs
相关文档:
要用ASP来操作SQLite数据库,前提条件是在服务器上得安装SQLite的ODBC驱动程序,可到这个站点上下载安装:http://www.ch-werner.de/sqliteodbc/,安装好后就可以像使用Access一样来使用SQLite了!下边是一个SQLite数据库结构:
引用内容
Create TABLE admin(username text,age integer);
我们再来用ASP演示下如何对SQLi ......
session
===================================
session对象用于存储特定的用户会话所需的信息 。 Session对象的引入是为了弥补HTTP协议的不足,HTTP协议是一种无状态的协议。
Session中文是“会话”的意思,在ASP中代表了服务器与客户端之间的“会话”。Session的作用时间从用户到达某个特定的 ......
最近做一个网站,该网站需要添加4000多 产品信息,如果用人工方法去别的网站copy那至少要花费半月时间才能完成,所以我个办法使用c#作出来了一个网页数据采集软件
详细出处参考:http://www.jb51.net/article/21468.htm
//提取产品列表页中产品最终页的网页
private void button1_Click(object sender, EventArgs e)
......
index.asp文件 保存utf-8
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
<form id="form1" name="form1" method="post">
<input name="ip" type="text" id="ip" style="width:170px" />
</form>
<mce:script type="text/javascript" src="ajaxrequest-m ......