Twitter widget help - not synchronising

Topics: Controls
Dec 14, 2010 at 1:49 PM

I am trying to setup a Twitter widget on a test blog, but it doesn't appear to be pulling through any Twitter post. Does anyone know why this might happen? 

I have tried using the following feed URLs:

  1. http://twitter.com/statuses/user_timeline/apsetweets.xml
  2. http://twitter.com/statuses/user_timeline/215212657.rss

I've looked in the IIS and system logs, but there don't seem to be any errors generated. 

Any clues?

Many thanks.

Coordinator
Dec 14, 2010 at 5:58 PM

In BE 1.6.1 on my computer, I tried your 2nd URL (.RSS) one, and the Twitter widget is populating the latest tweets.

On your site, I notice there's always a long lag (20 seconds) after the top part renders.  This can be fixed by going into the control panel, Settings tab, Advanced Settings and uncheck "Compress WebResource.axd".  The lag actually probably is not directly related to the Twitter issue -- but still would be nice to fix.

Check the App_Data folder.  There may be a logger.txt file.  If an error occurs while the Twitter widget is retrieving tweets, it may be logged there.

A possible change you can make that may or may not help is in the /widgets/Twitter folder, there is a file named widget.ascx.cs.  On line 150 (I think) is this line of code:

request.Credentials = CredentialCache.DefaultNetworkCredentials;

Either remove that line or comment it out, by adding two forward slashes in front of it, //

Then try pulling up the site to see if it works.  After first pulling it up, you may need to wait a few seconds and then refresh the page since it needs to go out and get the tweets.

Dec 15, 2010 at 10:01 AM

I have sorted out the Compress WebResource issue and now the blog loads quickly. 

The log file has the following error:

Date: 15/12/2010 
10:41:02Contents Below
Error retrieving Twitter feed. The 'meta' start tag on line 56 does not match the end tag of 'head'. Line 58, position 3.

I tried commenting out the credentials request, but the above error still generated and the feed does not come through. 

If my web host was running internet security software that prevented access to social networking sites, would that make a difference? I just tried loading the RSS feed in IE, whilst logged onto the server, but it was blocked under an internet use policy. Looks like it's treating HTTP requests from IIS in the same way as those from IE.

Thanks for your help. 

Coordinator
Dec 15, 2010 at 6:03 PM

That's a good clue you found about not being able to access the feed when using IE while on the server.  That would definitely be relevant.  When BE goes out to get the feed, it is just making a regular HTTP request (port 80).  The same thing that a browser like IE does.  So basically, if you cannot access the feed from the server when using IE, chances are BE is also not going to be able to do it either.

If the security policy was coming from IE directly, then BE might still have a chance.  But if it's a computer wide security policy or something like a firewall, I would expect BE to also fall under that security restriction.

The two workarounds that come to mind would be a proxy service where you set the Twitter URL to some other site, including your Twitter ID (215212657) in the querystring, and the proxy service would go and get the feed for you and pass it back to you.  In this scenario, you wouldn't be going directly to twitter.com, but to some other domain name.  I'm not sure of a service like this offhand.

The other, probably more practical workaround would be to not use the BE Twitter widget, but to instead use a JavaScript based Twitter widget.  I think there's probably a lot of these.  If you go to this one directly on Twitter.com, you'll see that you can click "My Website" on the left (Widgets for...) and then choose one of the widgets.  I think you are probably looking for the "Profile Widget".  It's a wizard you go thru, and they will generate some JavaScript that you can put on your site.  You could put it in your site's theme file (probably site.master).  And then your latest tweets will be retrieved via JavaScript from the visitor's browser ... rather than coming from your server.  I'm guessing the vast majority of people who display Latest Tweets on their websites (not BE, but just throughout the internet) are probably using a JS based widget like this.