views:

126

answers:

2

Is it possible to change the web.config file without giving all the users on the site a new session?

+3  A: 

If you don't use InProc session state, then your sessions should persist across application restarts.

sessionState Element (Including notes on configuring SqlServer mode.

Zhaph - Ben Duguid
+3  A: 

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.

Brad Tutterow
This works well and I don't have to change my application to use something other than InProc.
Espo