locked
ConfigurationManager.AppSettings["MyID"] vs configuration.AppSettings.Settings["MyID"].Value RRS feed

  • Question

  • Are these two, ConfigurationManager.AppSettings["MyID"] and configuration.AppSettings.Settings["MyID"].Value the same?

    When can I use ConfigurationManager and when Configuration?

    Tuesday, April 2, 2019 7:48 PM

Answers

  • You should be using the following to get one setting else access .AllKeys to iterate settings.

    ConfigurationManager.AppSettings["MyID"];

    This is invalid as the above is a string and string has no property named Value


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, April 2, 2019 9:19 PM

All replies

  • You should be using the following to get one setting else access .AllKeys to iterate settings.

    ConfigurationManager.AppSettings["MyID"];

    This is invalid as the above is a string and string has no property named Value


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, April 2, 2019 9:19 PM

  • Hi  Jeff0803, 

    It would be appreciated if you could close the thread by marking helpful posts as an answer. This will help other members to find the solution quickly if they have faced the similar issue. If you have a new question you can start a new thread. 

    Thank you for your understanding.

    Best Regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 13, 2019 9:27 AM