2 global.asa
Hej !Jeg har det problem at jeg har 2 forskellige scripts på min hjemmeside der begge bruger global.asa. Hver for sig virker de fint, men hvis jeg så smider koden for den ene ind i den anden så virker første script ikke mere. Men kan kan jo ikke have 2 global.asa vel ?
Sådan her ser den ene ud :
<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 = 5
' 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>
og sådan her den anden :
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(0)
'--
Application("FrontPage_UrlVars") = FrontPage_UrlVars
'==FrontPage Generated - endspan==
'*******************************************************************************************************************
' Make sure Data Source points to your RAMS Oracle Database
'*******************************************************************************************************************
Application("dbString") = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Calendar.mdb") & ";"
'*******************************************************************************************************************
' Database timeout values, and instance username and passwords (redundant)
'*******************************************************************************************************************
Application("dbTimeout") = 15
Application("dbTimeout") = 30
Application("dbCursorLocation") = 3
End Sub
Sub FrontPage_StartSession
On Error Resume Next
if Len(Application("FrontPage_VRoot")) > 0 then Exit Sub
sFile = "global.asa"
sRootPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
if Left(sRootPath,1) = "/" then sSep = "/" else sSep = "\"
if Right(sRootPath,1) <> sSep then sRootPath = sRootPath & sSep
sRootPath = sRootPath & sFile
' discover the VRoot for the current page;
' walk back up VPath until we match VRoot
Vroot = Request.ServerVariables("PATH_INFO")
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 Server.MapPath(Vroot & sFile) = sRootPath 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
Sub Session_OnStart
FrontPage_StartSession '==FrontPage Generated==
UserAgent = Request.ServerVariables("HTTP_USER_AGENT")
If InStr(1,UserAgent,"MSIE 5.") < 0 OR InStr(1,UserAgent,"MSIE 6.") < 0 then
Response.Write UserAgent & "<hr>"
Response.Write "Browser Not Supported...."
Session.Abandon
Response.End
End If
End Sub
</SCRIPT>
Er der en der kan skrive den sammen i en global.asa så de virker eller hur fixer jeg den ?
