如何把ASP编写成DLL,如何把ASP编写成DLL
【 tulaoshi.com - ASP 】
服务器端组件Set ObjReference = Server.CreateObject("ProjectName.ClassName")
Set ObjReference = Server.CreateObject("Example1.HelloWorld")
现在我们就能用ObjReference来调用我们在组件中所创建的函数,子程序.下面我们会来写一个SayHello的子程序, 我们执行它的代码如下: <%
Set ObjReference = Server.CreateObject("Example1.HelloWorld")
ObjReference.SayHello
%
为了在Helloword类中使用ASP的方法,你必须在此类中写一个OnStartPage Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
End Sub
现在,无论什么时候用户访问一个带有本组件的ASP文件,IIS就会把ScriptingContext传送给我们的对象请我们使用.这个ScriptingContext包括了全部的ASP方法和属性.实现上,这使得我们有能力访问所有ASP的对象.看下面的代码: Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
Set MyApplication = MyScriptingContext.Application
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
Set MyServer = MyScriptingContext.Server
Set MySession = MyScriptingContext.Session
End Sub
Private MyScriptingContext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server [next]
Private MySession As Session
使用ASP的对象 <%
MyTempVariable = Request.Form("userName")
Response.Write ("you entered "& MyTempVariable & "as your user name")
%
在VB中实现: MyTempVariable = MyRequest.Form("userName")
MyResponse.Write ("you entered "& MyTempVariable & "as your user name"
来源:http://www.tulaoshi.com/n/20160129/1500373.html
看过《如何把ASP编写成DLL》的人还看了以下文章 更多>>