开发者

Is there anything wrong with modifying the web.config file dynamically

I read this article. I was planning on creating a setup page that runs and allows the user to change the sql connection strings which is stored in the web.config file. With some changes this may help in deployment or even development. My question is is it possible to change the connection string i开发者_运维问答n the web.config file based on user input and is this advisable. N.B The connection string must be contained in the web.config

THank you


You may find helpful this blogpost on this topic.


hmmmm. Changing the web.config file would cause the app to restart. At least that's what would normally happen and from my understanding of the dependencies involved would happen if you did it from code.

That might be acceptable to you though & it is the best way to do it if the restart is acceptable.

Simon


It's possible to modify web.config based upon user input. It's just an XML file.

We do this as part of a custom action in an installer (MSI).

Modifying a web.config will cause the application pool to recycle though. Depending on your site, this (recycling) may or may not be a big deal.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜