Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6108847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:20:23+00:00 2026-05-23T14:20:23+00:00

I am using ConfigurationManager.AppSettings[myKey] to read a value from the app.config file in my

  • 0

I am using ConfigurationManager.AppSettings[myKey] to read a value from the app.config file in my windows application, but the value returned is always null, even though the key exists and it has a value, Deas any one know why?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:20:23+00:00Added an answer on May 23, 2026 at 2:20 pm

    One, perhaps easier, alternative is to use a Settings file. This encapsulates the creation and maintenance of App.config values in a designer GUI and generates code for accessing the values.

    To add a Settings file, right click your project in VS and click ‘Add -> New Item’, select ‘Settings file’ and give it a meaningful name, e.g. MainSettings.settings. You can then add an item, e.g. Foo, specify whether it is application or user-wide, define it’s type and a assign it a value. In your code you can retreive the value by simple writing MainSettings.Default.Foo.

    After compilation, you can change the value by editing the config file. The setting will appear as follows:-

    <applicationSettings>
        <YourNamespace.MainSettings>
            <setting name="Foo" serializeAs="String">
                <value>Bar</value>
            </setting>
        </YourNamespace.MainSettings>
    </applicationSettings>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ConfigurationManager.AppSettings collection to retreive configuration values from a Web.config file in
I'm using C# .NET 2.0 Windows Application. and I'm using app.config for my Application
I'm using configuration manager in the simplest way: Read: ConfigurationManager.AppSettings[Foo] Write: Configuration config =
In my machine.config file I have the following <configuration> .... <appSettings> <add key=key value=value/>
When I just had an app.config, everytime I tried ConfigurationManager.AppSettings[0] or ConfigurationManager.AppSettings[keyName] I got
I am using mvc3 c#. And the appsettings from the config manager works fine
I'm trying to persist user settings to a configuration file using ConfigurationManager. I want
I am using this class for writing into config file. Code is builted and
I have a web.config file that's transformed using a web.debug.config file. Trying to get
I am using following code: var names = ConfigurationManager.AppSettings.AllKeys.Where(k => k.StartsWith(name)); and i get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.