Asp.net-读取App.config

读取App.config

1.添加引用 System.Configuration.dll

2.using System.Configuration;

3.ConfigurationManager.AppSettings[key]

<!-- xml -->
<appSettings>
    <add key="ref" value="1" />
    <add key="dll" value="2" />
</appSettings>
var dll = ConfigurationManager.AppSettings["dll"];//1
var @ref = ConfigurationManager.AppSettings["ref"];//2

读取数据库连接字符串

var str = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

Asp.net-读取App.config

上一篇:AndroidStudio中提示:Couldn't find meta-data for provider with authority


下一篇:自动化--APP UI自动化--Airtest点击悬浮