Can I set the connection string for custom session state mode in global.asax file?
I cannot hard code the connection string in the webconfig file. ,I will get the connection string at runtime,Can i set the connection string for custom sessionmode/sqlserver session mode in the global.asax file(like in application statrevent, or aquirerequeststate event.If YES How to do that?
Thanks!!
No, it is not possible to modify this setting dynamically once the application has started. A possible workaround as proposed in this article is to test in the Application_Start if the connection string needs to be set and if yes then modify web.config which will cause the application domain to reload.
IMHO a better way to manage different connection strings among different environments is to have a step in your build process that does the necessary modifications to
web.configbefore deploying.