asp.net修改web.config文件
2024-10-08 03:17:26
private void UpdateConfigFile()
{
var cfg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
if (cfg.ConnectionStrings.ConnectionStrings["masterConnString"] == null)
{
var elCon = cfg.ConnectionStrings.ConnectionStrings["ElectricConnString"];
cfg.ConnectionStrings.ConnectionStrings.Add(new ConnectionStringSettings { Name = "masterConnString", ProviderName = "System.Data.SqlClient", ConnectionString = elCon.ConnectionString.Replace("Electric", "master") });
cfg.Save();
}
}
最新文章
- C语言(函数)学习之index、rindex
- include指令和include标签的区别
- Python面试必须要看的15个问题
- ASP.NET 4.5.256 has not been registered on the Web server
- View的getLeft, getRight, getTop, getBottom
- bzoj3574[Hnoi2014]抄卡组
- 设置自己Eclipse代码风格(内部)
- iOS 给UITextView加一个placeholder
- base64_encode与base64_decode
- Mysql主从复制_模式之日志点复制
- 使用Setup factory打包WPF
- C++或C#调用外部exe的分析
- [C#]关于路径的几则笔记
- A1制作文件夹目录
- SNF软件开发机器人-子系统-功能-数据列表分页与不分页-瀑布式分页-如何配置?
- FileWriter向文件中写入内容
- chrome console 阻止 Navigated to
- ssh框架中,工具类调用service层方法(参考https://www.cnblogs.com/l412382979/p/8526945.html)
- ARP协议,以及ARP欺骗
- CSS 笔记(一)