Reference:
Http://www.cnblogs.com/sxw_cug/archive/2013/02/28/1785477.html
Http://www.cnblogs.com/jiaxa/p/3326631.html?utm_source=tuicool
Http://www.cnblogs.com/Gyoung/p/3590778.html
As we all know, after modifying the configuration file Web. config in ASP. NET, it causes the application to restart and all sessions (session) are lost. However, the application configuration information in the configuration file is the best choice, in the background to modify the configuration to cause all session loss is very uncomfortable, this time the configuration file will often need to change
parameter configuration sectionPut it outside, for example AppSetting Festival.
First, the original Web. config file:
<appSettings>
<add key= "SiteDomain" value= "chinaxx.com"/>
</appSettings>
</configuration>
Two (1/2), now Web. config files
ConfigSource= "Config\appsettings.config"/>
</configuration>
Appsettings.config file in the Config directory of two (2/2) and now
<?xml version= "1.0" encoding= "Utf-8"?>
<appSettings>
<add key= "Cachetimeinfo" value= "/>"
<add key= "Cachetimenews" value= "ten"/>
<add key= "cachetimeproduct" value= "/>"
<add key= "Cachetimetrade" value= "5"/>
<add key= "SiteName" value= "China Fork Net"/>
<add key= "SiteDomain" value= "chinaxx.com"/>
</appSettings>
This will not cause a reboot if the Config\appsettings.config file is modified in the program.
Use configsource in the Web. config file to avoid dynamically modifying Web. config to cause ASP.