home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 March / VPR0003B.ISO / nec98 / global.asa < prev    next >
Text File  |  1999-10-14  |  2KB  |  75 lines

  1. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  2.  
  3. Sub Session_OnStart
  4.  
  5.   ' Determine if we are using IE and set session variable to major version number
  6.   On Error Resume Next
  7.   Dim br
  8.   Set br = Server.CreateObject("MSWC.BrowserType") 
  9.   If Err.Number = 0 Then
  10.     If br.browser = "IE" Then
  11.       Session("IEVersion") = CInt(br.majorver)
  12.     End If
  13.   End If
  14.  
  15. End Sub
  16.  
  17. Sub Application_OnStart
  18.  
  19.     ' Can't have any failures
  20.     On Error Resume Next    
  21.  
  22.     Application.Lock
  23.  
  24.     ' ODBC DSN
  25.     Application("DSN") = "SQLfreq.dsn"
  26.     
  27.     ' Get some preferances
  28.     Call GetFontPrefs
  29.     Call GetAdminPrefs
  30.  
  31.     Application.Unlock
  32. End Sub
  33.  
  34. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  35. Sub GetFontPrefs
  36.     On Error Resume Next
  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("/IISSamples/ExAir/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. End Sub
  52.  
  53. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  54. Sub GetAdminPrefs
  55.  
  56.     On Error Resume Next
  57.  
  58.     ' Use the AdminPrefs.txt file to set Application Variables.    
  59.     Dim stTextLine, intEqualPosition, stVarName, stVarValue, fso, txtSettings
  60.     Set fso = Server.CreateObject("Scripting.FileSystemObject")
  61.     set txtSettings = fso.OpenTextFile(Server.MapPath("/IISSamples/ExAir/SiteAdmin/AdminPrefs.txt"))
  62.     Do Until txtSettings.AtEndOfStream
  63.         stTextLine = txtSettings.ReadLine
  64.         intEqualPosition = Instr(1, stTextLine, "=")
  65.         If intEqualPosition <> 0 Then
  66.           stVarName = Left(stTextLine, intEqualPosition - 1)
  67.           stVarValue = Right(stTextLine, len(stTextLine) - intEqualPosition)
  68.           Application(stVarName) = CBool(stVarValue)
  69.         End If
  70.     Loop
  71.  
  72. End Sub
  73.  
  74. </SCRIPT>
  75.