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
kumar sudhir1
Posts
-
Not able to read the value from App.config file -
Not able to read the value from App.config fileI 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
-
Not able to read the value from App.config fileI 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: 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
-
Not able to read the value from App.config fileI 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: 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