Last night at study group, Brian Genisio showed us how to create a simple twitter search client using Silverlight. Impressively, we had a large turnout, and almost everyone came prepared with the prerequisites. (Go us!) We learned about how to get started with Silverlight in Visual Studio, lay out an application with xaml, and how to call the C# codebehind that gives an app functionality. During the jam, we all worked on a basic tutorial created by Brian that taught us how to create the base app. Those who finished that got additional hints for how to upgrade it with extra functionality. Brian was great, instantly coming up with a mock twitter service when we had some problems getting through to the twitter API on our network. At the end of an hour, I had an app running in my browser that displayed tweets, user images, and names for a given search string! See you all next time for Iron Python with Darrell Hawley, same time, same place! |
Thanks for the review, Bill and Marina!
I wanted to add that I figured out why the Twitter service was failing. Rich Internet Application (RIA) frameworks like Flash and Silverlight do not allow you to access services from a different domain unless that domain includes a crossdomain.xml file in the root directory giving access to the services. This is a security feature. See http://en.wikipedia.org/wiki/Cross-site_scripting for more information.
The day before, when I built the content, http://search.twitter.com/crossdomain.xml existed. As of last night, it was removed. Great timing, eh?
How might we get around this issue when developing your Twitter client? Cross Site Scripting (xss) issues are only a problem with client technologies in the browser. You can create a service on your web server back-end that proxies back to the twitter service. Since the actual service call is not initiated from the client, the xss issue is resolved.
If this would be useful for me to write up, please reply to this thread, and I will blog it up sometime soon.
Thanks again,
Brian Genisio
By the way, as of today 11/17/09, the twitter crossdomain.xml file is back up, if you want to play with it directly from Silverlight: http://search.twitter.com/crossdomain.xml