web.config 組態讀取-外部檔案
Posted In:
ASP.NET 2.0
,
System.Configuration
.
By 卡西卡
- 一般組態
web.config<?xml version="1.0"?>
<configuration>
<appSettings file="out.config">
<add key="in_string" value="IN"/>
</appSettings>
</configuration>
out.config<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="out_string" value="out" />
</appSettings>
讀取組態:System.Configuration.ConfigurationManager.AppSettings["in_string"]
System.Configuration.ConfigurationManager.AppSettings["out_string"] - 連線組態
讀取組態:System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString
內部<?xml version="1.0"?>
<configuration>
<connectionStrings
<add name="default" connectionString="Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
外部<!-- web.config -->
<?xml version="1.0"?>
<configuration>
<connectionStrings configSource="conn.config" />
</configuration>
<!-- conn.config -->
<connectionStrings>
<add name="default" connectionString ="data=out;uid=;pid=;"/>
</connectionStrings>
ASP.NET 1.1 是用 System.Configuration.ConfigurationSettings.AppSettings["default"]
1 Response to web.config 組態讀取-外部檔案
yeezy 500
goyard
lebron 16
yeezy boost
yeezy boost 350
balenciaga shoes
jordan shoes
kyrie 4
hermes belt
kyrie 3
Something to say?