Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Serialize and Deserialize
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00691120
Message ID:
00691492
Vues:
14
>>
>>OK, yeah, it looks like I need the ConfigurationSettings (GetConfig) class since this isn't quite application-level stuff. But, it would fit nicely in the user-defined portion of the configuration file. Thanks.
>
>I (mistakenly) thought this would be easier than it has turned out to be. Since I'm trying to create a stand-alone class, I had to create a test app so I could try things out. At first, it choked on ANY entry I made to app.config, so I just commented out the form code that called System.Configuration.AppSettingsReader. Then I was able to add a new section to app.config. Now it's throwing an error when I attempt to read this section. I've played around with it and done some searching but I haven't found anything that has helped. My app.config looks like:
>

OK, I figured out what was missing. The app.config file needs to look like:
<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
   <configSections>
      <section name="TestConfig" type="System.Configuration.NameValueSectionHandler" />
   </configSections>

  <appSettings>
    <!--   User application and configured property settings go here.-->
    <!--   Example: <add key="settingName" value="settingValue"/> -->
    <add key="button1.Enabled" value="True" />    
  </appSettings>
  
  <TestConfig>
    <add key="sampleKey" value="true" />  
  </TestConfig>   
</configuration>
I didn't realize you had to configure the sections first, then add them. Silly me...
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform