global.asa question (asp pages)

D

Doris Edwards

Hello,
I have several .mdb Access databases stored with on a web server (not my
own, but with a very professional hosting service). I have developped .asp
forms with FrontPage

The individual web applications are placed in /webroot/(name of web) of the
hosting server's web server.

The databases belonging to the individual applications are stored in
/webroot/data of the hosting server's web server. I have established a DSN
pointer in ODBC data sources to point to the databases. All this works fine
when there is one application and one database.

The global.asa is generated by FrontPage is placed into /webroot, and off we
go.

The problem comes when there are several databases. My question :

FrontPage generates a global.asa for each application (I know that there can
be only one per application). As global.asa needs to be at the webroot, how
does this then work ? I have modified global.asa to include the pointers to
DSN's. I am listing the modified global.asa file than here below. But maybe
this is not the right approach. I get errors when opening the forms

Would be most grateful for your help. Thanks. Doris
---------------------------------------
Contents of GLOBAL.ASA

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(4)
'--Project Data Connection
Application("Catalogue_ConnectionString") = "DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=URL=data/Catalogue.mdb"
FrontPage_UrlVars(0) = "Catalogue_ConnectionString"
Application("Catalogue_ConnectionTimeout") = 15
Application("Catalogue_CommandTimeout") = 30
Application("Catalogue_CursorLocation") = 3
Application("Catalogue_RuntimeUserName") = "rikkit"
Application("Catalogue_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("Losinger2_ConnectionString") = "DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=URL=data/Losinger.mdb"
FrontPage_UrlVars(1) = "Losinger2_ConnectionString"
Application("Losinger2_ConnectionTimeout") = 15
Application("Losinger2_CommandTimeout") = 30
Application("Losinger2_CursorLocation") = 3
Application("Losinger2_RuntimeUserName") = "rikkit"
Application("Losinger2_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("GHS2004_ConnectionString") = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=URL=data/GHS2004.mdb"
FrontPage_UrlVars(2) = "GHS2004_ConnectionString"
Application("GHS2004_ConnectionTimeout") = 15
Application("GHS2004_CommandTimeout") = 30
Application("GHS2004_CursorLocation") = 3
Application("GHS2004_RuntimeUserName") = "rikkit"
Application("GHS2004_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("CatalogueVessy_ConnectionString") = "DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=URL=data/CatalogueVessy.mdb"
FrontPage_UrlVars(0) = "CatalogueVessy_ConnectionString"
Application("CatalogueVessy_ConnectionTimeout") = 15
Application("CatalogueVessy_CommandTimeout") = 30
Application("CatalogueVessy_CursorLocation") = 3
Application("CatalogueVessy_RuntimeUserName") = "rikkit"
Application("CatalogueVessy_RuntimePassword") = "ehql+cfz"
'--
Application("FrontPage_UrlVars") = FrontPage_UrlVars
'==FrontPage Generated - endspan==
End Sub
Sub Session_OnStart
FrontPage_StartSession '==FrontPage Generated==
End Sub
Sub FrontPage_StartSession
On Error Resume Next
if Len(Application("FrontPage_VRoot")) > 0 then Exit Sub
' discover the VRoot for the current page;
' walk back up VPath until we find global.asa
Vroot = Request.ServerVariables("PATH_INFO")
strG1 = "global.asa"
strG2 = "Global.asa"
iCount = 0
do while Len(Vroot) > 1
idx = InStrRev(Vroot, "/")
if idx > 0 then
Vroot = Left(Vroot,idx)
else
' error; assume root web
Vroot = "/"
end if
if FrontPage_FileExists(Server.MapPath(Vroot & strG1)) then exit do
if FrontPage_FileExists(Server.MapPath(Vroot & strG2)) then exit do
if Right(Vroot,1) = "/" then Vroot = Left(Vroot,Len(Vroot)-1)
iCount = iCount + 1
if iCount > 100 then
' error; assume root web
Vroot = "/"
exit do
end if
loop
' map all URL= attributes in _ConnectionString variables
Application.Lock
if Len(Application("FrontPage_VRoot")) = 0 then
Application("FrontPage_VRoot") = Vroot
UrlVarArray = Application("FrontPage_UrlVars")
for i = 0 to UBound(UrlVarArray)
if Len(UrlVarArray(i)) > 0 then FrontPage_MapUrl(UrlVarArray(i))
next
end if
Application.Unlock
End Sub
Sub FrontPage_MapUrl(AppVarName)
' convert URL attribute in conn string to absolute file location
strVal = Application(AppVarName)
strKey = "URL="
idxStart = InStr(strVal, strKey)
If idxStart = 0 Then Exit Sub
strBefore = Left(strVal, idxStart - 1)
idxStart = idxStart + Len(strKey)
idxEnd = InStr(idxStart, strVal, ";")
If idxEnd = 0 Then
strAfter = ""
strURL = Mid(strVal, idxStart)
Else
strAfter = ";" & Mid(strVal, idxEnd + 1)
strURL = Mid(strVal, idxStart, idxEnd - idxStart)
End If
strOut = strBefore & Server.MapPath(Application("FrontPage_VRoot") &
strURL) & strAfter
Application(AppVarName) = strOut
End Sub
Function FrontPage_FileExists(fspath)
On Error Resume Next
FrontPage_FileExists = False
set fs = CreateObject("Scripting.FileSystemObject")
Err.Clear
set istream = fs.OpenTextFile(fspath)
if Err.Number = 0 then
FrontPage_FileExists = True
istream.Close
end if
set istream = Nothing
set fs = Nothing
End Function
</SCRIPT>
 
C

Chris Freeman

Doris,

Try using the Web Settings to clean this up. Menu Bar,
Tools, Web Settings. Then click your database and clck
Verify. If the database is not shown, click ADD, then
browse through to find the database. It will self verify.

Plus, what kind of errors are you getting?

chris

-----Original Message-----
Hello,
I have several .mdb Access databases stored with on a web server (not my
own, but with a very professional hosting service). I have developped .asp
forms with FrontPage

The individual web applications are placed in /webroot/ (name of web) of the
hosting server's web server.

The databases belonging to the individual applications are stored in
/webroot/data of the hosting server's web server. I have established a DSN
pointer in ODBC data sources to point to the databases. All this works fine
when there is one application and one database.

The global.asa is generated by FrontPage is placed into /webroot, and off we
go.

The problem comes when there are several databases. My question :

FrontPage generates a global.asa for each application (I know that there can
be only one per application). As global.asa needs to be at the webroot, how
does this then work ? I have modified global.asa to include the pointers to
DSN's. I am listing the modified global.asa file than here below. But maybe
this is not the right approach. I get errors when opening the forms

Would be most grateful for your help. Thanks. Doris
---------------------------------------
Contents of GLOBAL.ASA

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(4)
'--Project Data Connection
Application("Catalogue_ConnectionString") = "DRIVER= {Microsoft Access
Driver (*.mdb)};DBQ=URL=data/Catalogue.mdb"
FrontPage_UrlVars(0) = "Catalogue_ConnectionString"
Application("Catalogue_ConnectionTimeout") = 15
Application("Catalogue_CommandTimeout") = 30
Application("Catalogue_CursorLocation") = 3
Application("Catalogue_RuntimeUserName") = "rikkit"
Application("Catalogue_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("Losinger2_ConnectionString") = "DRIVER= {Microsoft Access
Driver (*.mdb)};DBQ=URL=data/Losinger.mdb"
FrontPage_UrlVars(1) = "Losinger2_ConnectionString"
Application("Losinger2_ConnectionTimeout") = 15
Application("Losinger2_CommandTimeout") = 30
Application("Losinger2_CursorLocation") = 3
Application("Losinger2_RuntimeUserName") = "rikkit"
Application("Losinger2_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("GHS2004_ConnectionString") = "DRIVER= {Microsoft Access Driver
(*.mdb)};DBQ=URL=data/GHS2004.mdb"
FrontPage_UrlVars(2) = "GHS2004_ConnectionString"
Application("GHS2004_ConnectionTimeout") = 15
Application("GHS2004_CommandTimeout") = 30
Application("GHS2004_CursorLocation") = 3
Application("GHS2004_RuntimeUserName") = "rikkit"
Application("GHS2004_RuntimePassword") = "ehql+cfz"
'--Project Data Connection
Application("CatalogueVessy_ConnectionString") = "DRIVER={Microsoft Access
Driver (*.mdb)};DBQ=URL=data/CatalogueVessy.mdb"
FrontPage_UrlVars(0)
= "CatalogueVessy_ConnectionString"
 
K

Kevin Spencer

Hi Doris,

You're close, and I don't blame you for misunderstanding a bit under the
circumstances. In an ASP application, the global.asa file must reside in the
APPLICATION ROOT (not the WEB (domain) ROOT). This might seem like a trivial
difference, but it is not. A web site is different than a Web Domain, and a
Web Domain can have multiple web sites and web applications
inside/underneath it. Each Subweb can be configured as an Application, in
which case you can actually store a global.asa file in that directory and it
will function as the global.asa file for that ASP application. So, you can
have multiple subwebs (web sites) under your root domain, each with its own
Application, and its own global.asa file.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
D

Doris Edwards

Thank you VERY VERY MUCH Kevin. I now understand ! Its the Subweb idea I
did not grasp ! everything works fine now as far as global.asa.

I will have some other questions on formatting which I will post to this
Forum.

You have really greatly helped me.
Best regards. Doris
 
R

Richard W

Along this line, after a reinstall of FP and PWS4, the global.asa in each of my subwebs doesn't function. If I move each one, separately, to the root, the subweb application runs correctly

Help? Please
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

global.asa 4
ADO CursorType Problem 6
Changing Global.asa 1
Trouble getting started with FP & Access 4
Increasing time outs 2
Working with Access & Excel 1
How can I redirect to a URL? 0
ASP & Html 1

Top