While
Saturday, February 23, 2008
Creating Custom Configuration Sections in Web.config
Most ASP.NET applications include a number of configuration settings, such as connection strings, mail server settings, system-wide default settings, and so forth. While these settings could be hard-coded in the source code, it's usually a wiser idea to place them in a configuration file, such as Web.config. The reasoning being that if these values need to be modified, editing a configuration file is a lot easier than updating the code, rebuilding, and re-deploying. In fact, Web.config provides an section intended to hold application-wide configuration settings (see Specifying Configuration Settings in Web.config for more details).
While work well for in-house applications, if you are building an application that will be deployed by end users a more professional approach is to use a custom configuration section. , for example, requires that all values be simple scalars provided through elements, like:
While
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment