Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Not able to read the value from App.config file

Not able to read the value from App.config file

Scheduled Pinned Locked Moved C#
securityhelpquestionworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kumar sudhir1
    wrote on last edited by
    #1

    I want to read the security key value from App.config file. Below is the procedure which I did : Create a new config file name as App.config In the App.config file: Added this: After that I did the following: System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader(); when i am debugging these, i find that the value of dimension is 0 which supposed to 1. since there is one key-value present in the App.config string key = (string)settingsReader.GetValue("SecurityKey", typeof(String)); Also it's throwing an exception stating “The key "SecurityKey" does not exist in the appSettings configuration section”.--which already present in the App.config. Also i tried with the second scenario: string key = System.Configuration.ConfigurationManager.AppSettings["SecurityKey"]; which giving me the key value null. Do i required to do some setting for reading the "SecurityKey" Value? Needs help! Thanks Sudhir Kumar Sudhir Kumar

    B N 2 Replies Last reply
    0
    • K kumar sudhir1

      I want to read the security key value from App.config file. Below is the procedure which I did : Create a new config file name as App.config In the App.config file: Added this: After that I did the following: System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader(); when i am debugging these, i find that the value of dimension is 0 which supposed to 1. since there is one key-value present in the App.config string key = (string)settingsReader.GetValue("SecurityKey", typeof(String)); Also it's throwing an exception stating “The key "SecurityKey" does not exist in the appSettings configuration section”.--which already present in the App.config. Also i tried with the second scenario: string key = System.Configuration.ConfigurationManager.AppSettings["SecurityKey"]; which giving me the key value null. Do i required to do some setting for reading the "SecurityKey" Value? Needs help! Thanks Sudhir Kumar Sudhir Kumar

      B Offline
      B Offline
      Bhupi Bhai
      wrote on last edited by
      #2

      Sudhir, Since I am unable to see your app.config file I am assuming this: C# Code: string key = System.Configuration.ConfigurationSettings.AppSettings["SecurityKey"].ToString(); This should work without any problem. Regards, Bhupesh.

      1 Reply Last reply
      0
      • K kumar sudhir1

        I want to read the security key value from App.config file. Below is the procedure which I did : Create a new config file name as App.config In the App.config file: Added this: After that I did the following: System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader(); when i am debugging these, i find that the value of dimension is 0 which supposed to 1. since there is one key-value present in the App.config string key = (string)settingsReader.GetValue("SecurityKey", typeof(String)); Also it's throwing an exception stating “The key "SecurityKey" does not exist in the appSettings configuration section”.--which already present in the App.config. Also i tried with the second scenario: string key = System.Configuration.ConfigurationManager.AppSettings["SecurityKey"]; which giving me the key value null. Do i required to do some setting for reading the "SecurityKey" Value? Needs help! Thanks Sudhir Kumar Sudhir Kumar

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Posting the question once and only in one forum will get you answers. Posting more than once and to different forums will get you ignored.


        only two letters away from being an asset

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups