global.asa

G

Guest

I don't think my global.asa file is executing. My site is in a seperate
partition. Would this have an effect on the startup?

I keep getting a Connection Not Defined when I try to connect a Form to
either a MS SQL or an Access database.

Below is the global.asa file


<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(2)
'--Project Data Connection
Application("data_ConnectionString") = "DSN=Logbook;DRIVER={SQL
Server};UID=??;PWD=????????"
Application("data_ConnectionTimeout") = 15
Application("data_CommandTimeout") = 30
Application("data_CursorLocation") = 3
Application("data_RuntimeUserName") = "???"
Application("data_RuntimePassword") = "??????"
'--Project Data Connection
Application("logbook_ConnectionString") = "DSN=logbook;DRIVER={Microsoft
Access Driver (*.mdb)}"
Application("logbook_ConnectionTimeout") = 15
Application("logbook_CommandTimeout") = 30
Application("logbook_CursorLocation") = 3
Application("logbook_RuntimeUserName") = ""
Application("logbook_RuntimePassword") = ""
'--
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
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
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
</SCRIPT>
<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
 
K

Kevin Spencer

What do you mean by the sentence "My site is in a seperate [sic] partition"?
Separate partition from what?

Here is how the global.asa file works in an ASP application:

The global.asa file is a special script that contains event handlers for
various Application- and Session-level events, such as Application_OnStart,
Session_OnStart etc. In order for it to work correctly, it must reside in
the root folder of your web application. A web application is defined as a
set of folders and files that reside under or in a folder which is
configured via IIS as the root folder of a web application. The root folder
is the bottom-most folder of the web application.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.
 
G

Guest

My web is not in the C:\ but, I did understand your explanation and I
checked the IIS setup and it's configured for the H:\ which is the
appropriate partition. I just can't figure out why I can't connect to the
databases.

I tried to import an Access Database and get an error:
An error occured accessing your FP web files. Authors, if authoring against
a web server, please contact the webmaster for the server's site.
WebMasters- please see the servers system log for more details.

Heck I can't find the Servers system log. I find nothing in the event log.



Kevin Spencer said:
What do you mean by the sentence "My site is in a seperate [sic] partition"?
Separate partition from what?

Here is how the global.asa file works in an ASP application:

The global.asa file is a special script that contains event handlers for
various Application- and Session-level events, such as Application_OnStart,
Session_OnStart etc. In order for it to work correctly, it must reside in
the root folder of your web application. A web application is defined as a
set of folders and files that reside under or in a folder which is
configured via IIS as the root folder of a web application. The root folder
is the bottom-most folder of the web application.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.


Gismo said:
I don't think my global.asa file is executing. My site is in a seperate
partition. Would this have an effect on the startup?

I keep getting a Connection Not Defined when I try to connect a Form to
either a MS SQL or an Access database.

Below is the global.asa file


<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(2)
'--Project Data Connection
Application("data_ConnectionString") = "DSN=Logbook;DRIVER={SQL
Server};UID=??;PWD=????????"
Application("data_ConnectionTimeout") = 15
Application("data_CommandTimeout") = 30
Application("data_CursorLocation") = 3
Application("data_RuntimeUserName") = "???"
Application("data_RuntimePassword") = "??????"
'--Project Data Connection
Application("logbook_ConnectionString") = "DSN=logbook;DRIVER={Microsoft
Access Driver (*.mdb)}"
Application("logbook_ConnectionTimeout") = 15
Application("logbook_CommandTimeout") = 30
Application("logbook_CursorLocation") = 3
Application("logbook_RuntimeUserName") = ""
Application("logbook_RuntimePassword") = ""
'--
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
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
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
</SCRIPT>
<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
 
K

Kevin Spencer

Well, you're not giving me a lot of information, but I'll give it my best
shot.

You say that IIS is configured to use the H drive as the root web? What
exactly is the physical file path to the root web folder? How did IIS get
configured this way? Does the web site have FrontPage server extensions set
up on it? Are you making an HTTP request for the page?

The IIS logs are usually fond in C:\WINDOWS\system32\Logfiles. However, this
is also configurable in IIS, so it may not be the same, but I suspect it is.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.


Gismo said:
My web is not in the C:\ but, I did understand your explanation and I
checked the IIS setup and it's configured for the H:\ which is the
appropriate partition. I just can't figure out why I can't connect to the
databases.

I tried to import an Access Database and get an error:
An error occured accessing your FP web files. Authors, if authoring
against
a web server, please contact the webmaster for the server's site.
WebMasters- please see the servers system log for more details.

Heck I can't find the Servers system log. I find nothing in the event
log.



Kevin Spencer said:
What do you mean by the sentence "My site is in a seperate [sic]
partition"?
Separate partition from what?

Here is how the global.asa file works in an ASP application:

The global.asa file is a special script that contains event handlers for
various Application- and Session-level events, such as
Application_OnStart,
Session_OnStart etc. In order for it to work correctly, it must reside in
the root folder of your web application. A web application is defined as
a
set of folders and files that reside under or in a folder which is
configured via IIS as the root folder of a web application. The root
folder
is the bottom-most folder of the web application.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.


Gismo said:
I don't think my global.asa file is executing. My site is in a seperate
partition. Would this have an effect on the startup?

I keep getting a Connection Not Defined when I try to connect a Form to
either a MS SQL or an Access database.

Below is the global.asa file


<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(2)
'--Project Data Connection
Application("data_ConnectionString") = "DSN=Logbook;DRIVER={SQL
Server};UID=??;PWD=????????"
Application("data_ConnectionTimeout") = 15
Application("data_CommandTimeout") = 30
Application("data_CursorLocation") = 3
Application("data_RuntimeUserName") = "???"
Application("data_RuntimePassword") = "??????"
'--Project Data Connection
Application("logbook_ConnectionString") =
"DSN=logbook;DRIVER={Microsoft
Access Driver (*.mdb)}"
Application("logbook_ConnectionTimeout") = 15
Application("logbook_CommandTimeout") = 30
Application("logbook_CursorLocation") = 3
Application("logbook_RuntimeUserName") = ""
Application("logbook_RuntimePassword") = ""
'--
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
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
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
</SCRIPT>
<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
 
G

Guest

Sorry for not being very descriptive.

We I select the IIS Manager and select the default web site from the tree.
Right click/properties, and the
Home Dir. Tab
H:\WEB
script source access (checked)
read(checked)
write(checked)
Execute Permissions (scripts only)
App Protection (Low..)

Server Extentions Tab
Enable Authoring(checked)
Vers. Control (none)
Tune for < 100 pages
VB Script

Server Extentions 2002 Tab
Microsoft SharePoint is installed on this site.
Version 5.0.2.2623

I am making a HTTP request for the new page.

Here is the top portion of the page.
Toward the bottom is what I added to test the execution of the global file.
The code is a MS recommendation for troubleshooting.
<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("logbook_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "Logbook", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic,
adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(3)
Dim arFormDBFields0(3)
Dim arFormValues0(3)

arFormFields0(0) = "areas"
arFormDBFields0(0) = "Area"
arFormValues0(0) = Request("areas")
arFormFields0(1) = "requestors"
arFormDBFields0(1) = "Requestors"
arFormValues0(1) = Request("requestors")
arFormFields0(2) = "priority"
arFormDBFields0(2) = "comp"
arFormValues0(2) = Request("priority")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

FP_FormConfirmation "text/html; charset=windows-1252",_
"Form Confirmation",_
"Thank you for submitting the following information:",_
"Change_Request.asp",_
"Return to the form."

End If
End If

%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Change Request</title>
</head>
<body>

<p>TIME: <% =Time() %></p>

<!-- Replace XXX with the name of your database connection. -->
<p>DATA: <% =Application("data_ConnectionString") %></p>


Kevin Spencer said:
Well, you're not giving me a lot of information, but I'll give it my best
shot.

You say that IIS is configured to use the H drive as the root web? What
exactly is the physical file path to the root web folder? How did IIS get
configured this way? Does the web site have FrontPage server extensions set
up on it? Are you making an HTTP request for the page?

The IIS logs are usually fond in C:\WINDOWS\system32\Logfiles. However, this
is also configurable in IIS, so it may not be the same, but I suspect it is.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.


Gismo said:
My web is not in the C:\ but, I did understand your explanation and I
checked the IIS setup and it's configured for the H:\ which is the
appropriate partition. I just can't figure out why I can't connect to the
databases.

I tried to import an Access Database and get an error:
An error occured accessing your FP web files. Authors, if authoring
against
a web server, please contact the webmaster for the server's site.
WebMasters- please see the servers system log for more details.

Heck I can't find the Servers system log. I find nothing in the event
log.



Kevin Spencer said:
What do you mean by the sentence "My site is in a seperate [sic]
partition"?
Separate partition from what?

Here is how the global.asa file works in an ASP application:

The global.asa file is a special script that contains event handlers for
various Application- and Session-level events, such as
Application_OnStart,
Session_OnStart etc. In order for it to work correctly, it must reside in
the root folder of your web application. A web application is defined as
a
set of folders and files that reside under or in a folder which is
configured via IIS as the root folder of a web application. The root
folder
is the bottom-most folder of the web application.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

It takes a tough man to make a tender chicken salad.


I don't think my global.asa file is executing. My site is in a seperate
partition. Would this have an effect on the startup?

I keep getting a Connection Not Defined when I try to connect a Form to
either a MS SQL or an Access database.

Below is the global.asa file


<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(2)
'--Project Data Connection
Application("data_ConnectionString") = "DSN=Logbook;DRIVER={SQL
Server};UID=??;PWD=????????"
Application("data_ConnectionTimeout") = 15
Application("data_CommandTimeout") = 30
Application("data_CursorLocation") = 3
Application("data_RuntimeUserName") = "???"
Application("data_RuntimePassword") = "??????"
'--Project Data Connection
Application("logbook_ConnectionString") =
"DSN=logbook;DRIVER={Microsoft
Access Driver (*.mdb)}"
Application("logbook_ConnectionTimeout") = 15
Application("logbook_CommandTimeout") = 30
Application("logbook_CursorLocation") = 3
Application("logbook_RuntimeUserName") = ""
Application("logbook_RuntimePassword") = ""
'--
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
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
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
</SCRIPT>
<OBJECT RUNAT=Server SCOPE=Session ID=MyInfo PROGID="MSWC.MyInfo">
</OBJECT>
 

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

Top