As applications became more complex and started offering more configurable features, a natural progression was to use configuration files to store these values. It has since become a required feature of any application to support the use of configuration files to control various aspects of itself and to avoid hard-coding of variable data. Most Windows applications support this with the use of .ini files or entries in the Windows registry.ASP.NET includes this support by the use of machine.config and web.config files.These files are standard text files written using XML formatting and can be edited with any text editor such as Notepad or an XML parser.With the use of these files, ASP.NET provides the ability to modify many standard settings used within Web applications as well as allowing the creation of custom settings.

The configuration of a given Web application is computed in a hierarchical manner when the application is first accessed and then cached to speed up future references to the configuration.ASP.NET then monitors the configuration files for any changes, and if a change is detected, the cached configuration is flushed and recomputed.

In this chapter, we will go over the way ASP.NET uses its configuration files and how we can best take advantage of this feature. We will also discuss the application, system, and security aspects of the configuration files and work through the creation of a web.config file.

0 0

Post a comment