Search : 
  Powered by FindinSite

ASP Documentation
• Introduction
• Getting started
• Dynamic-CD wizard
Passwords & Encryption
• Overview
• Example 1
• Example 2
• The script language
• Script examples
• Database scripts
Technical details
• Applications
• Built-in objects
• Character Encoding
• Cookies
• Database CDs
• Development tips
• FAQs
• Future developments
• Global.asa
• Network support
• Object registration
• Resources
• ScriptingContext
• Server-side includes
• Sessions
• Technical limits
ASP Sessions and Applications

Each new IP address access of Dynamic-CD starts a new Session, with associated SessionID. Each IP address has its own set of Session variables. Session variables are not retained between runs of Dynamic-CD.

A Session lasts until the Session is abandoned with  Session.Abandon  or until Dynamic-CD exits. The Session.Timeout value is currently ignored and Sessions do not timeout.

At the start and end of each session, the root directory of the web site is searched for the file global.asp and the events  Session_OnStart  and  Session_OnEnd  are fired.

Starting Dynamic-CD starts a (single) Application. Terminating Dynamic-CD closes the Application. The related events  Application_OnStart  and  Application_OnEnd  are fired.

Standard ASP uses the file global.asa, stored in the site root directory, to hold Session and Application event code.

The ASP syntax of this file is, arguably, non-standard. Dynamic-CD, instead, uses the file global.asp, which can be encrypted by Dynamic-CD-Wizard and which should be written using normal script syntax.

If the file global.asp exists in your root directory, it MUST provide support for Session and Application events, even if these are null.

If global.asp contains any functions that output to the browser, such as  Response.Write , any output is ignored.

Support for  Response.Redirect  in global.asp is not yet implemented.

See below for information about the <OBJECT> tag.

Example of using global.asp

A global.asp file :

SUB log2file( comment)
  ' write comment to log file
  set fs = Server.CreateObject( "Scripting.FileSystemObject")
  set myFile = fs.OpenTextFile( "applog.txt", 8, TRUE)
  myFile.WriteLine cstr( NOW()) + " - " + comment
  set myfile = nothing
  set fs = nothing

SUB Application_OnStart
  log2file "app start"
  Application( "Greeting") = "Application : hello"

SUB Application_OnEnd
  log2file "app end"

SUB Session_OnStart
  log2file "session " + session.sessionID + " started"
  Session( "Greeting") = "Hello, your sessionID is " &_

SUB Session_OnEnd
  log2file "session " + session.sessionID + " end"

A test script :

  Session( "sessVar1") = "sessVarVal1"
  Session( "sessVar2") = "sessVarVal2"
  Response.Write "SessionID = " + Session.SessionID
  Response.Write "<BR>sessVar1 = " + Session( "sessVar1")
  Response.Write "<BR>sessVar2 = " &_
    Session.Contents( "sessVar2")
  Response.Write "<BR>number of session variables = " &_
    cstr( Session.Contents.Count)
  for each thing in Session.Contents
  Response.Write "<BR>" + thing + " = " &_
    session.contents( thing)
Response.Write "<BR>App greeting = " &_ Application( "Greeting") Response.Write "<BR>App greeting = " &_ Application.Contents( "Greeting") Response.Write "<BR>number of application variables = " &_ cstr( Application.Contents.Count) for each thing in Application.Contents Response.Write "<BR>" + thing + " = " &_ Application.contents( thing) next Session.Abandon %>

Application.StaticObjects, Session.StaticObjects
The ASP script language does not support <OBJECT> tags in "global.asp" and so the collections Application.StaticObjects and Session.StaticObjects are always empty.

However, objects can be stored in the Application and Session Objects directly as in :

  Set Application( "dbCon") = _
    Server.CreateObject( "ADODB.Connection")
Note that the  Set  command is needed to set an object value.

Application.Lock, Application.Unlock
Dynamic-CD's ASP script language ignores calls to Application.Lock and Application.Unlock. Dynamic-CD's ASP scripts run to completion before another script is run and so other users of Dynamic-CD will not interfere with a given script run.

The Session.Timeout value is currently ignored and Sessions do not timeout.

The Session.CodePage property is fully supported by the Dynamic-CD International Version. Other versions of Dynamic-CD support the default CodePage (ANSI 1252), and the Unicode CodePage (65001).

The Unicode CodePage is supported by serving unchanged those characters whose ASCII value is less than 128. Characters whose ASCII value is greater than 127 are served as the HTML representation &#(ASCII);, where (ASCII) is the ASCII value as text.

So, for example,
Session.CodePage = 65001
response.write "la maison était créée ..."
is served as  
la maison &#233;tait cr&#233;&#233;e ...

   Home     Purchase     Licenses     Limitations     Version details     Site map     Contact     Copyright © 2000-2022 phdcc

  Dynamic-CD : the web server on CD Learn more | What's new