Twitterizer & .Net: Adding a feed to your website

Create a Twitter user:
http://twitter.com/

Register your application:
https://dev.twitter.com/apps/new
This gives you:
    <add key=”AccessToken” value=”blahblahblah”/>
    <add key=”AccessTokenSecret” value=”blahblahblah”/>
    <add key=”ConsumerKey” value=”blahblahblah”/>
    <add key=”ConsumerSecret” value=”blahblahblah”/>
Add it to your web.config

Go to:
http://www.twitterizer.net/downloads/
Download the Twitterizer package:
Twitterizer2-2.3.2.zip.

Add
Twitterizer2.dll and Newtonsoft.Json.dll
in your project references

Make an ASPX page with:
                    <div id=”homeDev”>
                        <fieldset style=”width: 230px”>
                            <legend>Development Buzz</legend>
                            <%=Data1%>
                        </fieldset>
                    </div>

Do this in the .CS
 public partial class Home : System.Web.UI.Page
    {
        private string _data1;
        public string Data1
        {
            get { return _data1; }
            set { _data1 = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ConnectTwitter();
        }

        protected void ConnectTwitter()
        {
            OAuthTokens tokens = new OAuthTokens();
            tokens.AccessToken = ConfigurationManager.AppSettings[“AccessToken”];
            tokens.AccessTokenSecret = ConfigurationManager.AppSettings[“AccessTokenSecret”];
            tokens.ConsumerKey = ConfigurationManager.AppSettings[“ConsumerKey”];
            tokens.ConsumerSecret = ConfigurationManager.AppSettings[“ConsumerSecret”];
           
            TwitterResponse<TwitterStatusCollection> statuses = TwitterTimeline.HomeTimeline(tokens);
            for (int i = 0; i < statuses.ResponseObject.Count; i++)
            {
                Data1 += “<p>”;
                Data1 += statuses.ResponseObject[i].Text.ToString();
                Data1 += “</p>”;
            }
        }
    }

© Copyright Duke Hall - Designed by Pexeto