- 爱易网页
-
ASP教程
- VB写的DLL在ASP里调用时报“未设置对象变量或 With block 变量”异常
日期:2014-05-17 浏览次数:21417 次
VB写的DLL在ASP里调用时报“未设置对象变量或 With block 变量”错误
小弟写的这个DLL结构如下:
Name= "MyDLL "
两个类:
Class=x; x.cls
Class=y; y.cls
没有公共类
其中:Class=x; x.cls 代码如下:
Public ScriptingContext As ScriptingContext
Public Application As Application
Public Request As Request
Public Response As Response
Public Server As Server
Public Session As Session
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set ScriptingContext = PassedScriptingContext
Set Application = ScriptingContext.Application
Set Request = ScriptingContext.Request
Set Response = ScriptingContext.Response
Set Server = ScriptingContext.Server
Set Session = ScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set ScriptingContext = Nothing
Set Application = Nothing
Set Request = Nothing
Set Response = Nothing
Set Server = Nothing
Set Session = Nothing
End Sub
Public Function f1( str )
Response.Write str
End Function
Class=y; y.cls 代码如下:
Public ScriptingContext As ScriptingContext
Public Application As Application
Public Request As Request
Public Response As Response
Public Server As Server
Public Session As Session
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set ScriptingContext = PassedScriptingContext
Set Application = ScriptingContext.Application
Set Request = ScriptingContext.Request
Set Response = ScriptingContext.Response
Set Server = ScriptingContext.Server
Set Session = ScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set ScriptingContext = Nothing
Set Application = Nothing
Set Request = Nothing
Set Response = Nothing
Set Server = Nothing
Set Session = Nothing
End Sub
Public Function f1( str )
f1 = x.f1( str )
End Function
ASP调用:
<%
dim mydll