Following up from my last question does anyone know how I can use a dictionary object in application scope in Classic ASP? You cannot use Scripting.Dictionary - if you try you will see something similar to the following:
从我的上一个问题跟进有没有人知道如何在Classic ASP中的应用程序范围中使用字典对象?您不能使用Scripting.Dictionary - 如果您尝试,您将看到类似于以下内容:
Application object error 'ASP 0197 : 80004005'
Disallowed object use /xxx.asp, line 2. Cannot add object with apartment model behavior to the application intrinsic object.
I found this article on (good ol') 4GuysFromRolla but it points to Microsoft's free Lookup Component and a free Dictionary Component from Caprock Consulting - both of which are dead links.
我在(好的)4GuysFromRolla上发现了这篇文章,但它指向微软的免费Lookup组件和Caprock Consulting的免费词典组件 - 两者都是死链接。
The article clearly explains why you can't use the Scripting.Dictionary in application scope, but I was wondering if anyone knew of a free alternative or where I might find a copy of the old components that 4GuysFromRolla mentioned?
这篇文章清楚地解释了为什么你不能在应用程序范围内使用Scripting.Dictionary,但我想知道是否有人知道一个免费替代品或者我可能找到4GuysFromRolla提到的旧组件的副本?
3 个解决方案
#1
I was able to download the Dictionary Component from Caprock Consulting using this link: http://web.archive.org/web/20000619122506/http://www.caprockconsulting.com/data/CaprockDCT.zip
我可以使用以下链接从Caprock Consulting下载Dictionary组件:http://web.archive.org/web/20000619122506/http://www.caprockconsulting.com/data/CaprockDCT.zip
#2
I have the LookupTable-component and can provide it to you if interested.
我有LookupTable组件,如果有兴趣可以提供给你。
However, I have notived that you can use .NET HashTable in application-scope which might be useful for you.
但是,我注意到您可以在应用程序范围内使用.NET HashTable,这可能对您有用。
just do this:
这样做:
<object id="YOUR_VAR_NAME" progid="System.Collections.HashTable" runat="Server" scope="Application"></object>
this will give you a global, application-wide HashTable-object.
这将为您提供一个全局的,应用程序范围的HashTable对象。
Beware of modifying this to heavily though, I have problems with memoryleaks where eventually the applications session-handling gets unreliable (doesn't invoke SessionStart properly)
请注意尽快修改它,但我遇到了memoryleaks的问题,最终应用程序会话处理变得不可靠(不会正确调用SessionStart)
#3
i had the same issue and ended up feeding the application variable with the content of my dictionary and added
我有同样的问题,最后用我的字典的内容喂养应用程序变量并添加
for each obj in application.Contents
if Left(obj,6) = "urlLog" then
application.Contents.Remove(obj)
end if
next
to kill all the application variables in the global.asa on application.end ( you could also use the Application.Contents.RemoveAll
but i heard there was som issue with it leaving some variable up and causing memory leak even tho i could net find any solid source to prove it ...
在application.end上杀死global.asa中的所有应用程序变量(你也可以使用Application.Contents.RemoveAll但我听说有一个som问题,它留下了一些变量并导致内存泄漏,即使我可以找到任何坚实的来源证明它......
anyway is the Caprock dictionary working for you ?
无论如何是Caprock字典为你工作?
#1
I was able to download the Dictionary Component from Caprock Consulting using this link: http://web.archive.org/web/20000619122506/http://www.caprockconsulting.com/data/CaprockDCT.zip
我可以使用以下链接从Caprock Consulting下载Dictionary组件:http://web.archive.org/web/20000619122506/http://www.caprockconsulting.com/data/CaprockDCT.zip
#2
I have the LookupTable-component and can provide it to you if interested.
我有LookupTable组件,如果有兴趣可以提供给你。
However, I have notived that you can use .NET HashTable in application-scope which might be useful for you.
但是,我注意到您可以在应用程序范围内使用.NET HashTable,这可能对您有用。
just do this:
这样做:
<object id="YOUR_VAR_NAME" progid="System.Collections.HashTable" runat="Server" scope="Application"></object>
this will give you a global, application-wide HashTable-object.
这将为您提供一个全局的,应用程序范围的HashTable对象。
Beware of modifying this to heavily though, I have problems with memoryleaks where eventually the applications session-handling gets unreliable (doesn't invoke SessionStart properly)
请注意尽快修改它,但我遇到了memoryleaks的问题,最终应用程序会话处理变得不可靠(不会正确调用SessionStart)
#3
i had the same issue and ended up feeding the application variable with the content of my dictionary and added
我有同样的问题,最后用我的字典的内容喂养应用程序变量并添加
for each obj in application.Contents
if Left(obj,6) = "urlLog" then
application.Contents.Remove(obj)
end if
next
to kill all the application variables in the global.asa on application.end ( you could also use the Application.Contents.RemoveAll
but i heard there was som issue with it leaving some variable up and causing memory leak even tho i could net find any solid source to prove it ...
在application.end上杀死global.asa中的所有应用程序变量(你也可以使用Application.Contents.RemoveAll但我听说有一个som问题,它留下了一些变量并导致内存泄漏,即使我可以找到任何坚实的来源证明它......
anyway is the Caprock dictionary working for you ?
无论如何是Caprock字典为你工作?