Solved

C# Read app.config

Posted on 2011-02-19
4
989 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 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