[dotNET]如何利用ConfigurationSettings.AppSettings.GetValues读取配置文件中多个同Key的value

news/2024/5/19 11:21:57

编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了



编写者:郑昀@Ultrapower

默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:

  
  
  
  

 
用MSDN告诉我们的GetValues是读不到的,只能读到最后一个value。
 
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们,
只有这么做才可以:
第一步:
单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中;
 
第二步:
编译MultipleSectionHandler,生成MultipleSectionHandler.dll;
 
第三步:
将WebApp应用的Web.config文件中加入

  
  

 
表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。
 
第四步:
这时候就可以针对Web.config中的:

  
  
  
  

 
通过
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
来读取了




http://www.niftyadmin.cn/n/3649299.html

相关文章

node.js 模块_如何创建Node.js模块

node.js 模块The author selected the Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program. 作者选择了“ 开放互联网/言论自由基金会”作为“ Write for DOnations”计划的一部分来接受捐赠。 介绍 (Introduction) In Node.j…

[收藏]Matt Powell的《Server-Side 异步Web Methhods》

Server-Side 异步Web Methhods http://msdn.microsoft.com/library/en-us/dnservice/html/service10012002.asp?frametrueMatt PowellMicrosoft CorporationOctober 2, 2002摘要:Matt Powell 介绍了如何在服务器端使用异步 Web 方法,来创建高性能的 Mic…

yarn命令和npm命令_npm vs纱线命令备忘单

yarn命令和npm命令Here’s a cheat sheet you can use as a handy reference for npm & Yarn. 这是一份备忘单,您可以将其用作npm& Yarn的方便参考。 There’s a lot of similarities between npm and Yarn. As the newer technology Yarn (release…

新建项目与数据库搭建

#新建项目与数据库配置 ### 一、新建项目 ### File——Gradle——JAVAWEB——勾选1和2,选择use local gradle distribution ### 二。添加依赖,build.gradle ### dependencies { // Gson json compile com.google.code.gson:gson:2.8.0 …

[EntLib]在SR.Strings中使用中文字符串资源

编写者:郑昀UltraPower要想在SR.Strings中使用中文字符串资源,必须这样:把你的SR.Strings文件保存为UTF-8编码的(具体操作是:VS.Net2003->文件菜单-高级保存选项,选择“Unicode(UTF-8 带签名) - 代码页 65001”)&am…

浅谈Android客户端项目框架

写Android也有些时间了,一边工作,一边学习,一边积累,只有遇到问题了,花时间去研究,自己的能力才能提升,刀如果不用,慢慢的就会生锈应该也是这个道理吧!上个月公司项目服务…

在JavaScript中建立倒数计时器

Countdown timers can serve many purposes. They can communicate to a user how long they’ve been doing something or how much time until some event happens, like the launch of your new website. 倒数计时器可以有多种用途。 他们可以与用户交流他们已经做了多长时间…

RxJava的简单使用(一)

一测试订阅 Test public void testSubscribe() {//观察者&#xff0f;订阅者final Subscriber<String> subscriber new Subscriber<String>() {Overridepublic void onCompleted() {System.out.println("onCompleted in tread:" Thread.currentThread().…