Dynamic-CD
 : 
  Powered by FindinSite

    
Support for ScriptingContext

Certain ActiveX components require the use of the ASP Built-In Objects Response, Request, Server, Session and Application

When an ASP script creates an component through a call to  Server.CreateObject , the server calls the component method  OnStartPage  and passes the ASP Built-In Objects via the  ScriptingContext . This allows the created component to use the ASP Built-In Objects as shown in the following Visual Basic code :

  Public mySC As ScriptingContext
  ' --------------------
  Public Sub OnStartPage(objScriptContext As ScriptingContext)
    Set mySC = objScriptContext
  End Sub
  '---------------------
  Public Sub doSomething()
    Set rp = mySC.Response
    Set rq = mySC.Request

    rp.Write "<BR>Hello world"
    rp.Write "<BR>URL = " + rq.ServerVariables("URL")
  End Sub

Note that  OnStartPage  takes a ScriptingContext as argument, not an Object.  OnStartPage  is called when the object is first instantiated.  OnEndPage  is called when the object is destroyed.

The use of ScriptingContext is itself now deprecated by Microsoft and they recommend the use of  ObjectContext  to access the Built-In Objects. Dynamic-CD support for this functionality may be added at a future date.

Objects that are created in a script but assigned to a Session variable have a life that continues until the end of the Session. A Session ends due to a call to  Session.Abandon  or when Dynamic-CD terminates. In the case of Session objects,  OnEndPage  is not called until the end of the Session.

A more developed example of the use of the ScriptingContext is given here.



 
   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