从web.config中的textfile获取连接字符串 [英] Get connection String from textfile in web.config
本文介绍了从web.config中的textfile获取连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从web.config访问文本文件或XML文件。
EX-我将所有连接字符串写在文本文件中并访问写入的连接字符串textfile通过web.config。
提前谢谢
解决方案
在你的web.config配置设置中添加
< appSettings >
< 添加 key = FilePath value = D:/ path >
< / appSettings >
使用
var path = ConfigurationManager.AppSettings [FilePath];
希望这有帮助
请,首先阅读我的评论。
如何:从Web.config文件中读取连接字符串 [ ^ ]
how To Access a Textfile or XML file from web.config.
EX- I have all the connectionstring written in text file and access those connection strings written in textfile through web.config.
thank you in advance
解决方案
In your web.config configuration settings add
<appSettings> <add key="FilePath" value="D:/path" > </appSettings>
And access using
var path = ConfigurationManager.AppSettings["FilePath"];
Hope this helps
Please, read my comment first.
How to: Read Connection Strings from the Web.config File[^]
这篇关于从web.config中的textfile获取连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文