Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Storing token info in external xml file?

$
0
0
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">
  <configuration>
    <appSettings>
      <add key="Consumerkey" value="twitter stuff"/>
      <add key="Consumersecret" value="twitter stuff"/>
      <add key="Accesstoken" value="twitter stuff"/>
      <add key="Accesstokensecret" value="twitter stuff"/>
    </appSettings>
  </configuration>
</xml>
When I run my app i get a 400 connection error. Dont know if im doing this right, stackoverflow didnt have any good examples.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>