ASP MagicINI Component
The MagicINI object allows you to manipulate
INI files from an Active Server Page. You can create INI entrees, read them, change and
delete values and sections.
Purchasing MagicINI
Component
Evaluation of MagicINI
Component
Support
Installation
Working with MagicINI
Evaluation of
MagicINI Component
Click here to download a 30-days evaluation
copy of MagicINI Component.
Purchasing MagicINI
Component
You can order MagicINI on-line or by phone from The
Registration Network.
Also, you may order by sending check to to: Dana Consulting Inc. (in the memo
field specify MagicINI)
Send it to:
Dana Consulting Inc.
14936 CreditView Drive
Savage, MN 55378
Please, print, fill out and enclose Order Form located in OrderForm.html file
Support
With any questions and/or suggestions email to support@dana-net.com.
Installation
- Stop the web server.
- To register MagicINI component move the MagicINI.dll into a subdirectory (like
\winnt\system32 for NT). To register the component on the system change to the directory
where you installed the DLL and type: regsvr32 MagicINI.dll
- Run Register.exe program, which comes with a
component. Leave the Key filed empty and make sure you have word Evaluation
in the name field and have the right component chosen under Component pull-down menu.
Click Register button. It will give you a message saying when your component expires.
- Restart the web server.
Working with
MagicINI
Calling
the MagicINI Object from an ASP page
To call the MagicINI Object from an Active Server Page, you
will need to create the object using the following code:
<%Set
MyObj=Server.CreateObject("MagicINI.Tricks")%>
Remember to enclose the code within <% %> brackets.
Writing a new string
The WriteString function copies a string into the specified section of the
specified initialization file.
If the function successfully copies the string to the initialization file, the return
value is TRUE.
The following example creates new entree "LastName" in the file "d:\temp\userinf.ini" under
Section "UserInformation" equals to "Ivanov":
- <%
Set MyObj=Server.CreateObject("MagicINI.Tricks")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
if myobj.WriteString(lpappname, lpkeyname, "Ivanov",
lpfilename) then
response.write "Value is written
successfully"
else
response.write myobj.ErrorDesc
response.write myobj.ErrorNum
response.write myobj.ErrorSrc
end if
%>
Note: If file or section name does not exist function WriteString will create
for you automatically.
Reading
the value in the ini files
- The ReadString function retrieves a string from the specified section
in an initialization file.
This example returns value of the "LastName" key under
"UserInformation" section.
- <%
Set MyObj=Server.CreateObject("MagicINI.Tricks")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
mystr = myobj.ReadString(lpappname, lpkeyname, lpfilename)
response.write "Last Name is " & mystr
%>
Deleting
Section in the ini File
The DeleteSection function deletes all contexts of the section.
This example deletes
"UserInformation" section from file "d:\temp\userinf.ini"
- <%
Set MyObj=Server.CreateObject("MagicINI.Tricks")
lpappname = "UserInformation"
lpfilename = "d:\temp\userinf.ini"
if myobj.DeleteSection(lpappname, lpfilename) then
response.write "Deleted successfully"
else
response.write myobj.ErrorDesc
response.write myobj.ErrorNum
response.write myobj.ErrorSrc
end if
%>
Deleting Keys in the ini File
The DeleteString function deletes string contexts of the section.
This example deletes key and associated value
in "LastName".
- <%
Set MyObj=Server.CreateObject("MagicINI.Tricks")
lpappname = "UserInformation"
lpkeyname = "LastName"
lpfilename = "d:\temp\userinf.ini"
if myobj.DeleteString(lpappname, lpkeyname, lpfilename) then
response.write "Value is Deleted
successfully"
else
response.write myobj.ErrorDesc
response.write myobj.ErrorNum
response.write myobj.ErrorSrc
end if
%>