Is it possible to change the web.config file without giving all the users on the site a new session?
the answer i found :- ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.
Yes you can have two web. config files in application. There are situations where your application is divided in to modules and for every module you need separate configuration. For example if you have a application which has two modules lets say accounts and sales.
When you edit the web. config, It will restart the AppDomain (NOT AppPool) of that web application and clears the all occupied resources and memory.
config, unlike any other file, can be deleted.. Yes the web. config could be removed you can test it. The Website will give you error once you have removed it.
You can move the volatile portions of the web.config into external files and then set up IIS to not restart applications when those files change.
In the example below, application and connection-string settings have been moved to another file, outside of the web.config.
<?xml version="1.0"?>
<configuration>
<appSettings configSource="appSettings.config"/>
<connectionStrings configSource="connections.config"/>
</configuration>
Once that's done, you can make changes to app settings (or whatever else you put in the external file) without editing the web.config.
You can also visit the machine.config and play with the restartOnExternalChanges attribute, but this should be used with caution as it could have unintended consequences. Some sections, such as app-settings, already have this set to "false".
<section name="appSettings" restartOnExternalChanges="false">
More details are available in this OdeToCode article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With