Solved

C# Read app.config

Posted on 2011-02-19
4
987 Views
Last Modified: 2013-12-17
Hi,

I have below app.config, how can I retrieve data (timeout, booster, ..)from this file?

 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
        <section name="UpdatePanel.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
</configSections>
<startup><supportedRuntime version="v2.0.50727"/></startup>
    <applicationSettings>
        <UpdatePanel.Properties.Settings>
            <setting name="TimeOut" serializeAs="String">
                <value>3000</value>
            </setting>
            <setting name="Bridge" serializeAs="String">
                <value>bridge.csm</value>
            </setting>
            <setting name="Booster" serializeAs="String">
                <value>booster.csm</value>
            </setting>
            <setting name="Firmware" serializeAs="String">
                <value>firmware.csm</value>
            </setting>
        </UpdatePanel.Properties.Settings>
    </applicationSettings>
</configuration>

Thanks,
JT
0
Comment
Question by:jtran007
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 34935962
Reading:
string timeOut=YourNamespace.Settings.Default.Timeout;

Writing:
YourNamespace.Settings.Default.Timeout=timeOut;
YourNamespace.Settings.Default.Save();
0
 
LVL 12

Accepted Solution

by:
Mamtha1982 earned 500 total points
ID: 34935964
Reading:
string timeOut=UpdatePanel.Settings.Default.Timeout;

Writing:
UpdatePanel.Settings.Default.Timeout=timeOut;
UpdatePanel.Settings.Default.Save();
0
 

Author Comment

by:jtran007
ID: 34937685
Hi guru,

Thanks. However your code shoul be:

string timeOut=YourNamespace.Properties.Settings.Default.Timeout;

Regards,
JT

0
 

Author Closing Comment

by:jtran007
ID: 34937687
Thanks,
JT
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

772 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