Forum Moderators: open

Message Too Old, No Replies

Combining Global.asa's

         

DataCom2005

3:25 pm on Aug 7, 2004 (gmt 0)

10+ Year Member



Hello,
I have added a db driven marquee to my site and need to combine the global asa's to 1 global asa file.

I would apreciate any help on this.

this is the 1st global asa
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart
' Set our user count to 0 when we start the server
Application("ActiveUsers") = 0
End Sub

Sub Session_OnStart
' Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
' Set a Session Start Time
' This is only important to assure we start a session
Session("Start") = Now
' Increase the active visitors count when we start the session
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.UnLock
End Sub

Sub Session_OnEnd
' Decrease the active visitors count when the session ends.
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.UnLock
End Sub

</SCRIPT>
<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatUsers"
PROGID="Scripting.Dictionary">
</OBJECT>

<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatRooms"
PROGID="Scripting.Dictionary">
</OBJECT>

<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatMessages"
PROGID="Scripting.Dictionary">
</OBJECT>

this is the 2nd global asa

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(1)
'--Project Data Connection
Application("Marquee_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/marquee.mdb"
FrontPage_UrlVars(0) = "Marquee_ConnectionString"
Application("Marquee_ConnectionTimeout") = 15
Application("Marquee_CommandTimeout") = 30
Application("Marquee_CursorLocation") = 3
Application("Marquee_RuntimeUserName") = ""
Application("Marquee_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
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>

Thanks for Your Help.
DataCom2005

Krapulator

6:28 am on Aug 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart
' Set our user count to 0 when we start the server
Application("ActiveUsers") = 0
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(1)
'--Project Data Connection
Application("Marquee_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/marquee.mdb"
FrontPage_UrlVars(0) = "Marquee_ConnectionString"
Application("Marquee_ConnectionTimeout") = 15
Application("Marquee_CommandTimeout") = 30
Application("Marquee_CursorLocation") = 3
Application("Marquee_RuntimeUserName") = ""
Application("Marquee_RuntimePassword") = ""
'--
Application("FrontPage_UrlVars") = FrontPage_UrlVars
'==FrontPage Generated - endspan==
End Sub

Sub Session_OnStart
' Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
' Set a Session Start Time
' This is only important to assure we start a session
Session("Start") = Now
' Increase the active visitors count when we start the session
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.UnLock
FrontPage_StartSession '==FrontPage Generated==
End Sub

Sub Session_OnEnd
' Decrease the active visitors count when the session ends.
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.UnLock
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>
<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatUsers"
PROGID="Scripting.Dictionary">
</OBJECT>

<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatRooms"
PROGID="Scripting.Dictionary">
</OBJECT>

<OBJECT
RUNAT="Server"
SCOPE="Application"
ID="conquerChatMessages"
PROGID="Scripting.Dictionary">
</OBJECT>

DataCom2005

6:47 pm on Aug 9, 2004 (gmt 0)

10+ Year Member



Krapulator

It works Great!

Thank You for Your help.

I appreciate it very Much.

Thanks,
DataCom

DataCom2005

8:14 pm on Aug 21, 2004 (gmt 0)

10+ Year Member



Hello,
I ran into a problem, the global.asa works but the page the marquee is on, now has a few items not working.

Do you see any conflicts here?

this is the code for site page.

%> <%
strStartTime = Timer
%>
<%
If Not rsSession.EOF Or Not rsSession.BOF Then
session("MM_Username") = rsSession("p_user")
end if
%> <%

If Not rsSession.EOF Or Not rsSession.BOF Then

if rsSession("p_user") <> "" then ****xm = rsSession("p_user")
set rsheadUpdatee = Server.CreateObject("ADODB.Recordset")
rsheadUpdatee.ActiveConnection = MM_conn_STRING
rsheadUpdatee.Source = "SELECT p_active FROM ads WHERE p_user = '" + Replace(****xm, "'", "''") + "'"
rsheadUpdatee.CursorType = 0
rsheadUpdatee.CursorLocation = 2
rsheadUpdatee.LockType = 3
rsheadUpdatee.Open()
rsheadUpdatee_numRows = 0

end if

%> ------code below not used but in the page----
<script language="JavaScript">
<!--
var theImages = new Array() // do not change this
theImages[0] = 'images/1.jpg'
theImages[1] = 'images/2.jpg'
theImages[2] = 'images/3.jpg'
theImages[3] = 'images/4.jpg'
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

//-->------code above not used but in the page---
</script>

this is the marquee code added to the page.

<% Response.Buffer=True %>
<%
'Create the Connection object
Dim DSN_Name
DSN_Name = Application("Marquee_ConnectionString")

set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open DSN_Name

'Create the recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'Set the SQL string
strSQL = "Select * from Marquee Where ID = 1"

'Open the recordset
rs.Open strSQL, DSN_Name

Dim MarqueeValue
Dim BackgrdColor
MarqueeValue = rs("Message")
BackgrdColor = rs("color")
%>

This is the code that is not working when the marquee code is added to the page.

executesearch.asp?field1=3&field2=1&field4=18&field5=99&Submit=Search+Ads

since this link doesn't work and gives me internal server error the conflict of code probably is in the
executesearch.asp and the marquee code above. because if I remove the marquee code the site works fine.

one of the problems if the conflict isn't in executesearch.asp is that executesearch.asp calls 3 other files.

here are links to those files if you want to see them.
[expressionstudios.com...]
[expressionstudios.com...]
[expressionstudios.com...]
[expressionstudios.com...]

Is there a way to modify the marquee code?
any ideas on this?

Thanks