When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
Published: Tuesday, January 19, 1999

Reading Standard Windows INI Files in ASP
By Bart Silverstein


Have you needed to get information dynamically from Standard Formatted Windows INI files? Here's a set of tools to help you with just that. In this tutorial, we are going to discuss specific actions. More details can be obtained by looking at the files supplied.

- continued -

Let's see how to implement the tools usage by looking at some parts of TEST.ASP:

<!--#include virtual="/readini/inifile.inc"-->

For fairly obvious reasons, we need to include the tools in our page, of course we should fix the path the include file is stored it.

<%
     call IniFileLoad("physical=c:\boot.ini")
%>

Next, a call to IniFileLoad fetches the INI file into a dictionary object called IniFileDictionary. You can specify a physical path as listed above, or you could specify a virtual path such as "virtual=/readini/test.ini".

StrBuf = IniFileValue("boot loader|timeout")
StrBuf = IniFileValue("boot loader")

Finally, we need to ask for a value from the dictionary. You can specify an individual value by using the section name and value name separated by a vertical bar (sometimes referred to as a 'pipe') character. Alternately, we can request the entire content of a section by not specifying the value name. When the section is returned, the data is formatted as:

   Section name|Value name=Value Data~Section name|ValueName=Value Data

Note that each section/value/data triplet is separated by a tilde character.

Well, that's all there is to it! Happy programming!

Attachments:
This ZIP file contains an INC file with the utility routines, a test INI file, and an ASP file that demonstrates the tools usage.

Related Articles
  • Automatically Configured Advertisement Display
  • Reading Windows INI Files Using ASP
  • Implementing a 'Tip of the Day' Popup Window in ASP
  • How to Ping using Active Server Pages
  • Dynamic Content Tree Creation
  •  


    Bart Silverstein has written several great articles for 4GuysFromRolla.com. When he is not writing articles, Bart is often found on the many ASP messageboards, answering questions.


    ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article