home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / Global.asa1 < prev    next >
Text File  |  1997-11-01  |  2KB  |  56 lines

  1. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  2.  
  3. Sub Session_OnStart
  4.  
  5.   On Error Resume Next
  6.  
  7.   ' Determine if we are using IE and set session variable to major version number
  8.   On Error Resume Next
  9.   Dim br
  10.   Set br = Server.CreateObject("MSWC.BrowserType") 
  11.   If Err.Number = 0 Then
  12.     If br.browser = "IE" Then
  13.       Session("IEVersion") = CInt(br.majorver)
  14.     End If
  15.   End If
  16.  
  17.   'Set session variable for whether to generate pages using RDS (such as DetailInsurance.asp)
  18.   If Session("IEVersion") >= 4 And Application("RDSAvailable") = "True" Then
  19.     Session("UseRDS") = "True"
  20.   Else 
  21.     Session("UseRDS") = "False"
  22.   End If
  23.  
  24. End Sub
  25.  
  26. Sub Application_OnStart
  27.  
  28.     On Error Resume Next
  29.  
  30.     ' Note that this application assumes that the dsn specified in prefs.txt is in 
  31.     '   the ODBC default directory for file DSN locations.
  32.  
  33.     ' If RDS not available on your server, you should change "RDSAvailable" value in 
  34.     '   prefs.txt to "False"!
  35.  
  36.     Application.Lock
  37.  
  38.     ' Use the Prefs.txt file to set Application Variables.    
  39.     Dim stTextLine, intEqualPosition, stVarName, stVarValue, fso, txtSettings
  40.     Set fso = Server.CreateObject("Scripting.FileSystemObject")
  41.     set txtSettings = fso.OpenTextFile(Server.MapPath("Prefs.txt"))
  42.     Do Until txtSettings.AtEndOfStream
  43.         stTextLine = txtSettings.ReadLine
  44.         intEqualPosition = Instr(1, stTextLine, "=")
  45.         If intEqualPosition <> 0 Then
  46.           stVarName = Left(stTextLine, intEqualPosition - 1)
  47.           stVarValue = Right(stTextLine, len(stTextLine) - intEqualPosition)
  48.           Application(stVarName) = stVarValue
  49.         End If
  50.     Loop
  51.  
  52.     Application.Unlock
  53. End Sub
  54.  
  55. </SCRIPT>
  56.