Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2004, 11:48 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help needed with a global.asa

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 appreciate 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,
DataCom
 
Old August 7th, 2004, 01:10 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If the idea is that we are going to do your work by combining this code, you'll be surprised by the lack of responses you'll get ;)

Are there any areas you're having problems with? What goes wrong when you simply copy and paste the code from each event to the second global.asa file?

If you have specific issues you find difficult to solve, please post them here. But I don't think you should expect people to do this for you....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: My Gift To You by KoRn (Track 14 from the album: Follow The Leader) What's This?
 
Old August 7th, 2004, 01:49 PM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
I already tried copying and pasting the events together in 1 file, what happenned was it quit displaying the users online.

I am not looking for someone to do this for me, I am trying to figure out how to make this work.

I thought going to a forum where there are people with more experience than me might help.

Sorry you thought I was looking for someone to do it for me as that wasn't my intent.




 
Old August 7th, 2004, 02:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, you're right in that you can go to a forum to get help from people with more experience than you.

But those people need your help to be able to help you. Just wading through almost 150 lines of code trying to figure out what it does and why it doesn't is not much fun.

How about you give some more information.... What is the code supposed to do? What errors do you get? What steps have you undertaken to fix the problem? What issues did you run into? What went wrong when you combined the code? How did you combine it? Did you just simply paste the entire code of the first file in the second, or dod you copy and paste the code for each method / event to the other, to combine the methods rather than the entire file?

Is all this Frontpage mess necessary? What are those dictionary objects used for? Are they used in the code elsewhere in the site? Is all the code strictly necessary, or can you do some cleanup and drop some old code?

Lots of questions.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The X-zone by Kid Morbid (From the album: Masters Of Hardcore IX ) What's This?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Global.asa pushpa Classic ASP Basics 19 March 9th, 2007 08:30 AM
About Global.asa pbcatan Classic ASP Databases 2 December 4th, 2006 12:40 AM
global.asa vin_0x1 Classic ASP Components 2 July 24th, 2006 01:13 AM
Global.asa madsmad ASP.NET 1.0 and 1.1 Basics 1 August 17th, 2003 07:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.