If the configuration file web. after config, the application will be restarted, and all session will be lost. in Versions later than NET Framework 2.0, You can include all configuration elements that support the configSource attribute in a single file. In this way, you do not need to restart the application or manage the application, so as to avoid putting all the configurations in the web. config file to make the page look messy. For example, appSetting and connectionStrings nodes.
Example:
Note: The file path in configSouce can only be a relative physical path, that is, it can only be a backslash (\) and cannot be a slash (/).
The first is the web. config file:
View Code
The following are two separate configuration files:
1. appSettings. config
View Code
2. connectionStrings. config
View Code
The reading method remains the same. As before, here we will write two:
ConfigurationManager. deleetask[] Dictionary <,> val = ConfigurationManager. deleetask[] [] rule = val. split ([] {Dictionary <,> dic = Dictionary <,> (item [] arr = item. split ([] {dic. add (. parse (arr []),. parse (arr [} View Code
PS: Look at the nose in the middle, Qi liuhai looks at the face, oblique bangs look at the temperament, no bangs look at the five senses... I am suitable for masked noodles !!!!