【发布时间】:2012-12-06 19:00:19
【问题描述】:
我正在尝试在 C# 代码中的 web.config 中动态设置连接字符串:
ConfigurationManager.ConnectionStrings["ServerConnection"].ConnectionString = "blah";
但它不允许我这样做并抛出以下错误:
The configuration is read only.
注意:如果可能,我不想实际保存到 web.config。只需在内存中动态设置即可。
【问题讨论】:
-
请参阅this question了解如何更改连接字符串。
标签: c# asp.net web-config