devxlogo

Use XML to Store Your App Settings in ASP

Use XML to Store Your App Settings in ASP

XML provides many opportunities to share and store data. One of the most common and simple uses of XML is to use it to store data used by your application.

Every application uses data. The traditional way to store this data was in INI files. Then came registries. Now, more and more applications use XML files to store their app settings.

With ASP, you typically store such data in the Application.Contents collection. Oftentimes, these are hardcoded into the Application_OnStart event. Rather than hardcoding these variables, you can store them in an XML file. Simply access the XML file in the Application_OnStart event to initialize the application variables. The XML file may look like this:

PropName1PropValue1PropName2PropValue2

You can also write the code to access the XML file and return an array with prop names and values in a COM component. This allows you to change any value in XML when the app is running and refresh the Application.Contents collection without having to restart the app to run the OnStart event. Simply call the Component’s method to refresh your variables!

ASP.NET uses a similar concept with a pre-created file called web.config for each ASP.NET application. This file simple XML file has a similar structure.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist