Storing token info in external xml file?

Jan 19, 2014 at 8:39 PM
Got a question on how to store the token and access info in a external xml/ config file so its not hard coded into the application. I searched around but could not find any good examples.

this is what i have so far
var config = ConfigurationManager.OpenExeConfiguration(@"C:\MyConfig.xml");
            string userKey = ConfigurationManager.AppSettings["Accesstoken"];
            string userSecret = ConfigurationManager.AppSettings["Accesstokensecret"];
            string consumerKey = ConfigurationManager.AppSettings["Consumerkey"];
            string consumerSecret = ConfigurationManager.AppSettings["Consumersecret"];
and my xml file
<?xml version="1.0" encoding="utf-8" ?>
<xml encoding="UTF8">
      <add key="Consumerkey" value="twitter stuff"/>
      <add key="Consumersecret" value="twitter stuff"/>
      <add key="Accesstoken" value="twitter stuff"/>
      <add key="Accesstokensecret" value="twitter stuff"/>
When I run my app i get a 400 connection error. Dont know if im doing this right, stackoverflow didnt have any good examples.
Jan 20, 2014 at 12:02 AM
Hi there,

If you download the source code, you will find a project called Examplinvi.
Examplinvi is giving an example showing how to store twitter credentials in the project configuration file.
 IToken token = new Token(
Having a 400 exception probably means that the credentials you provided were incorrectly loaded.
Would you please verify that your Token contains the expected information.