如何从ASP到VB6共享ASP经典会话变量? [英] How to share ASP classic session variable from ASP to VB6?
问题描述
我正在使用vp脚本在经典Asp中开发的项目,该脚本使用 Server.CreateObject
方法调用VB6 dll库.
I'm working on a project developed in classic Asp with vb script that calls a VB6 dll library with the Server.CreateObject
method.
我在ASP中创建了一个会话变量,并希望从 VB6 dll 中读取它.
I created a session variable in ASP and would like to read it from VB6 dll.
我在网上进行了很多搜索,但没有找到解决方案.这是与所连接的用户相关的数据,然后存储在会话变量中.
I searched a lot on the web but I didn't find solutions. This is data related to the user connected, then stored in a session variable.
我的目标是通过VB6 dll了解连接的用户.
推荐答案
我找到了解决方案,一个用户在论坛上帮助了我,我将链接放在下面.
I found the solution, a user helped me in a forum, I put the link below.
您可以在类中定义两个子类"OnStartPage"和"OnEndPage".例如:
Dim vSC As ScriptingContext
Public Sub OnStartPage(SC As ScriptingContext)
Set vSC = SC
End Sub
Public Sub OnEndPage()
Set vSC = Nothing
End Sub
(您需要在项目中添加对"Microsoft Active Server Pages对象库"的引用)
在创建对象(Server.CreateObject)和销毁对象(Set Obj = Nothing)时,IIS会自动调用此subs.这样,您就不需要"DataFromASP"子对象.ScriptingContext对象使您可以访问所有ASP对象(服务器,响应等)
这篇关于如何从ASP到VB6共享ASP经典会话变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!