MOTOBIT.COM - ASP upload, IIS utility ASP - Share application variables

Sample for Multi.Dictionary.Connect | Changes | Purchase | Download

Examples

      ScriptUtilities MultiDictionary lets you share variables (text, numbers, objects) in one process. This is idea sample to share ASP (ASPNet) Application objects between two or more IIS applications. You can share any type of variables - strings, numeric, arrays, objects with a top performance.
      You can also use Access ASP Application object from a remote script article (without external components). This article lets you share strings/numeric variables over internet (other ASP apps on the same or remote machine, VBS scripts).
      See also Share dictionary values over processes/remote computers (from VBSCript in ASP to WSH, ..).

ASP - Share application variables 
'Global.asa of application1:
<Object RunAt=Server ID=AppShare ProgID=Multi.Dictionary Scope=Application></Object>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
  AppShare.Connect "Applications"
  AppShare.Remove "A1"
  Set AppShare("A1") = Application
  Application("Key1") = "Some value"
End Sub

Sub Application_OnEnd
  AppShare.Remove "A1"
End Sub

</SCRIPT>


'Global.asa of application2:
<Object RunAt=Server ID=AppShare ProgID=Multi.Dictionary Scope=Application></Object>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart
  AppShare.Connect "Applications"
  AppShare.Remove "A2"

  Set AppShare("A2") = Application
  Application("Key1") = "Some other value"
End Sub

Sub Application_OnEnd
  AppShare.Remove "A2"
End Sub
</SCRIPT>

'Some ASP file in application1 can access both Application objects from App1 and App2:
<%
Response.Write "<br>Key1 from this application : " _
  & Application("Key1")
Response.Write "<br>Have we connect to other app? : " _
  & IsObject(AppShare("A2"))
If IsObject(AppShare("A2")) Then
  Response.Write "<br>Key1 from other application : " _
  & AppShare("A2")("Key1")
End If
%>

Script output:
Key1 from this Application : Some value
Have we connect To other app? : True
Key1 from other Application : Some other value

Other links for the ASP - Share application variables sample

Multi.Dictionary

Free threaded dictionary object. Lets you work with unique/non-unique keys, any VARIANT values and connect to other dictionary in the same process.
     Dictionary is a COM class specially designed as a free-threaded dictionary in Application scope of ASP/ASP.Net pages. It also works with script other engines in VB Script and JScript (ASP,ASP.Net, WSH, CHM, HTA), VB Net, Visual basic (VBA - VB 5, VB 6, Word, Excel, Access, …), C#, J#, C++, ASP, ASP.Net, Delphi and with T-SQL OLE functions - see Use ByteArray object article. You can also use the object in other programming environments with COM support, such is PowerBuilder.
     Source code for Dictionary is available within distribution license, please see License page for Multi Dictionary or License page for ASP file upload and ScriptUtilities.

Multi

Free-threaded (multithreaded) dictionary object. Lets you work with unique/non-unique keys in VBScript and JScript envinronment (share application/session variables in ASP) or any other programming language. You can share dictionary variables between processes or computers, you can save or restore dictionary variables to a disk, work with keys using regular expression and more.

© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object