2. I didn't know about Server.Execute (Yeah, I know, I am a newbie LOL).
This will be for me the best solution when it comes to dynamically
inserting
local documents into my ASP pages.
There are some limitations, of course, like variables not passed back and
forth between documents.
You can use the MTxSpm.SharedPropertyGroupManager object to pass
information between pages. You can pass anything you like from a page to
any page it calls using Server.Execute, and those pages can pass scalars
(but not objects) back. A short example follows:
index.asp:
<% Option Explicit
' A function that will be exposed to the page
Function F : F = "index.asp -- F()" : End Function
' Determine the page to execute
Dim page
Select Case Request.QueryString("page")
Case "c" : page = "c.asp"
Case "b" : page = "b.asp"
Case Else: page = "a.asp"
End Select
' Create a shared property group for that page
Dim grpMgr, propGrp, prop
Set grpMgr = CreateObject("MTxSpm.SharedPropertyGroupManager")
Set propGrp = grpMgr.CreatePropertyGroup(page, 0, 0, Empty)
' Create a shared property that provides access to F()
Set prop = propGrp.CreateProperty("F", Empty)
prop.Value = GetRef("F")
Server.Execute page
%>
a.asp, b.asp, c.asp (be sure to change the value of the Page constant for
each):
<% Option Explicit
Const Page = "a.asp"
' Get the shared property group the page
Dim grpMgr, propGrp, prop
Set grpMgr = CreateObject("MTxSpm.SharedPropertyGroupManager")
Set propGrp = grpMgr.CreatePropertyGroup(Page, 0, 0, Empty)
' Get the shared property that provides access to F()
Set prop = propGrp.CreateProperty("F", Empty)
Response.ContentType = "text/plain"
Response.Write "This is " & Page & vbNewLine
If IsObject(prop.Value) Then
Dim f: Set f = prop.Value
Response.Write "Got " & TypeName(prop.Value) & vbNewLine
Response.Write f()
Else
Response.Write "Expected function object but got " _
& TypeName(prop.Value) & vbNewLine
End If
%>