Application of Global.asa in ASP

Source: Internet
Author: User

  The function is to read the next INI file information in the publishing directory

<object id= "agobjorasession" runat= "Server" progid= "oracleinprocserver.xorasession" scope= "APPLICATION" >
</OBJECT>
<script Language=vbscript runat=server>
Const const_fl_name = "\getattributecode.ini"
Const const_fl_forreading = 1
Const const_db_section = "[Db_connection]" Sub Application_OnStart
On Error Resume Next

Dim OBJFS
Dim objTS
Dim Strlinedata
Dim flgsection
Dim Strtempdata

Application ("Service") = ""
Application ("User") = ""
Strlinedata = ""
Strtempdata = ""
Flgsection = False

  set OBJFS = Server.CreateObject ("Scripting.FileSystemObject")
  set objts = Objfs.opentextfile (Server.MapPath (const_fl_name), const_fl_forreading,false)
  if Err.Number < > 0 Then
    err.clear 
      Set objts = Nothing
     Set objfs = Nothing
    Exit Sub
  end If

While not Objts.atendofstream
Strlinedata = Objts.readline
If Trim (strlinedata) <> "" Then
If flgsection = True and Mid (strlinedata,1,1) = "[" And _
Mid (Strlinedata,len (Strlinedata), 1) = "]" Then
Objts.close
Set objTS = Nothing
Set OBJFS = Nothing
Exit Sub
End If

If Strlinedata = const_db_section Then
Flgsection = True
End If

If flgsection = True Then
If Mid (strlinedata,1,7) = "Service" Then
Strtempdata = Trim (Mid (Strlinedata,8,len (Strlinedata)-7))
If Mid (strtempdata,1,1) = "=" Then
Strtempdata = Trim (Mid (Strtempdata,2,len (Strtempdata)-1))
Application.Lock
Application ("Service") = Mid (Strtempdata,2,len (Strtempdata)-2)
Application.UnLock
End If
End If
If Mid (strlinedata,1,4) = "User" Then
Strtempdata = Trim (Mid (Strlinedata,5,len (Strlinedata)-4))
If Mid (strtempdata,1,1) = "=" Then
Strtempdata = Trim (Mid (Strtempdata,2,len (Strtempdata)-1))
Application.Lock
Application ("User") = Mid (Strtempdata,2,len (Strtempdata)-2)
Application.UnLock
End If
End If
End If
End If
Wend
Objts.close
Set objTS = Nothing
Set OBJFS = Nothing
End Sub
</SCRIPT>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.