ASP.NET - display 10 most relevant tweets in dot net application

Asked By gurpreet on 16-Jul-11 02:10 PM
hello frnzz.....please help me,,,,,,
    i want to create web application in with c#,,,,,,,,,,i want to display display 10 most relevant tweets in dot net application it means if i write tweets in tweeter then my application fetch that most relevant tweets from tweeter and then display i my application,,,,,so please any one help me,,,,,,,,,,,,,,,,,,
and send me complete code for this on my mail id or here

please help me
thanks in advance,,,,,,,,
dipa ahuja replied to gurpreet on 16-Jul-11 02:34 PM
Visit the twitter developer link:

You have to use their method to fetch the data from twitter to your website
Devil Scorpio replied to gurpreet on 16-Jul-11 03:01 PM
Hi gurpreet,

Check out the doc. Here's a sample from the page:

HttpClient http = new HttpClient("");
http.TransportSettings.Credentials = new NetworkCredential("{username}", "{password}");
HttpResponseMessage resp = http.Get("friends_timeline.xml");

To display 10 relevant tweets, several .NET Libraries that interface with the Twitter API
Radhika roy replied to gurpreet on 17-Jul-11 02:10 AM
For this you have to interect with Twitter .

follow these steps-

(1) Get a copy of the Twitterizer Library

First, you’ll need to get a copy of the The download is pretty small and contains only the application library (DLL) you need. Create a new website in ASP.NET and extract the twitterizer library to the /bin/ folder so that you can use it.  Once you have it placed in your /bin/ folder, add a “using” reference to the library in the header of your page.

using Twitterizer.Framework;

(2) Create a “Twitter” object and Retrieve Your Status Updates.

The library contains a few different objects that you can create. A “Twitter” object is the most generic object that you can create. Creating an instance of this object using your username and password gives you all the functionality you would normally have in Twitter, but instead of using the Twitter web interface, you’re using C# or Visual Basic. First, we’ll need to instantiate the object, and then get a collection of status updates from your account.

Twitter thisUser = new Twitter(“UserNameHere”, “PasswordHere”);
TwitterStatusCollection thisCollection = thisUser.Status.UserTimeline();

(3) Loop Through Your Status Updates and Generate Some HTML

The “TwitterStatusCollection” object type is a list of “TwitterStatus” objects, so you can use a foreach loop and go through your most recent status updates. You’ll notice in the code below that I also do some basic work with the time of the status update to generate a hyperlink to the page of the status, similar to what Twitter does.

string TwitterCode = “”;
foreach (TwitterStatus thisStatus in thisCollection)

TimeSpan thisSpan = new TimeSpan();
thisSpan = DateTime.Now.Subtract(thisStatus.Created);

string TimeBetween = “”;
if (thisSpan.Days > 0) { TimeBetween = thisSpan.Days.ToString() + ” days ago”; }
else if (thisSpan.Hours > 0) { TimeBetween = thisSpan.Days.ToString() + ” hours ago”;}
else if (thisSpan.Minutes > 0) { TimeBetween = thisSpan.Days.ToString() + ” minutes ago”;}
else if (thisSpan.Seconds > 0) { TimeBetween = thisSpan.Days.ToString() + ” seconds ago”;}

TwitterCode += “<div class=’TwitterStatus’>” + thisStatus.Text + ” <a href=’” + thisStatus.TwitterUser.UserName + “/status/” + thisStatus.ID + “‘>” + TimeBetween + “</a></div>”;

(4) Display Your Tweets

You now have a string with your most recent twitter status updates that you can display on the page using a simple Response.Write() or you can display it in a label. You can see a variation of this code running on the

You can also download a copy of my

Hope this will help you.