Reading in app.config file

Posted on 2006-05-16
Last Modified: 2011-04-14
i am using this app.config:

<?xml version="1.0" encoding="utf-8" ?>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
            <section name="TrustedSiteChanger.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" />
            <setting name="Sites" serializeAs="Xml">
                    <ArrayOfString xmlns:xsi=""

how do i read in the "Sites" into a string array in C#?
Question by:RepriseMIS
    1 Comment
    LVL 11

    Accepted Solution

    you can do  AppDomain.CurrentDomain.GetData("APP_CONFIG_FILE").ToString() and get the entire file as an xml. you can then parse it using xpath for instance.

    an other thing you can do is use

    System.Configuration.ClientSettingsSection YourClientSettings = (System.Configuration.ClientSettingsSection)ConfigurationSettings.GetConfig( "userSettings/TrustedSiteChanger.Properties.Settings" );

    i think you will chose the latest :)


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now