Big Gray Wolf's ASP toolbox-functions for reading INI configuration files using ASP.
Source: Internet
Author: User
Requirements:
You can read the corresponding values according to the Section and Key of the INI file.
For example, a configuration file
SMSVote. ini
---------------------------------
[SMSVote]
Server = (local)
DB = SMSVote
User = sa
PassWord = 123
[DB2Vote]
Server = 192.168.0.1
DB = DB2
User = sa
PassWord =
---------------------------------
Main program (method ):
Inifile. asp
-----------------------------------------------
<%
Set IniFileDictionary = CreateObject ("Scripting. Dictionary ")
Sub IniFileLoad (ByVal FilSpc)
IniFileDictionary. RemoveAll
FilSpc = lcase (FilSpc)
If left (FilSpc, 1) = "p" then
'Physical path
PhyPth = mid (FilSpc, instr (FilSpc, "=") + 1)
Else
'Virtual path
PhyPth = Server. MapPath (mid (FilSpc, instr (FilSpc, "=") + 1 ))
End if
Set FilSys = CreateObject ("Scripting. FileSystemObject ")
Set IniFil = FilSys. OpenTextFile (PhyPth, 1)
Do while not IniFil. AtEndOfStream
StrBuf = IniFil. ReadLine
If StrBuf <> "" then
'There is data on this line
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