本人正在学习asp封装成dll,当打开sayhello.asp的时候出现的错误提示如下:
Server 对象, ASP 0177 (0x800401F3)
无效的类别字符串 
/sayhello.asp, 第 8 行
请问是什么原因?sayhello.asp源文件
<html>
<head>
sayhello
</head>
<body>
<%
 dim ObjReference
 Set ObjReference = Server.CreateObject("productivity.chklogin")
 ObjReference.sayhello
 set objreference = nothing
%>
</body>
</html>productivity.dll源文件Private myscriptingcontext As ScriptingContext
Private myapplication As Application
Private myrequest As Request
Private myresponse As Response
Private myserver As Server
Private mysession As SessionPublic Sub onstarpage(passedscriptingcontext As ScriptingContext)
 Set myscriptingcontext = passedscriptingcontext
 Set myapplication = myscriptingcontext.Application
 Set myrequest = myscriptingcontext.Request
 Set myresponse = myscriptingcontext.Response
 Set mysession = myscriptingcontext.Session
End SubPublic Sub onendpage()
 Set myscriptingcontext = Nothing
 Set myapplication = Nothing
 Set myrequest = Nothing
 Set myresponse = Nothing
 Set mysession = Nothing
End SubPublic Sub sayhello()
 myresponse.Write ("您好!")
End Sub

解决方案 »

  1.   

    几个可能性.
    1、DLL没有注册
    2、DLL可能放到了NTFS分区的某个目录中,可能是NTFS文件系统的安全配置没弄好,最好把DLL放到System32目录中再注册使用,还有如果放到FAT分区中注册最好
    3、创建的对象名称错误。通常VB开发的这种COM组件的命名是 工程名.类名 创建的,比如工程名是
    MyLIB,而程序中使用的类名是 MyClass,那么创建用的名称就是 MyLIB.MyClass。
    如果上面都不能解决,也可以看看这样使用:
    Set ObjReference = CreateObject("productivity.chklogin")