⇒config文件结构:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<appSettings>
<add key="DBPath" value="C:\\xxxx\\aaaa\\zz\\zzz\a.mdb\">
</add>
<add key="PassWord" value="mypassword">
</add>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
⇒CS文件读取:
string strDBPath = System.Configuration.ConfigurationManager.AppSettings["WorkPath1"];
string strPwd = System.Configuration.ConfigurationManager.AppSettings["PassWord"];