<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Phil Leggetter - Software Consultant &#187; silverlight</title>
	<atom:link href="http://www.leggetter.co.uk/tag/silverlight/feed" rel="self" type="application/rss+xml" />
	<link>http://www.leggetter.co.uk</link>
	<description>Real-time web and social media software consultant</description>
	<lastBuildDate>Thu, 11 Mar 2010 10:40:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Silverlight uses XCP tmp files for Web Requests</title>
		<link>http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html</link>
		<comments>http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html#comments</comments>
		<pubDate>Fri, 05 Feb 2010 13:41:48 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[httpwebrequest]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=691</guid>
		<description><![CDATA[It would appear that the Silverlight runtime creates a file named XCP*.tmp of around 20MB within a users %temp% directory (where * can be replaced by random characters). This file would appear to be used in some way by the Silverlight runtime for web requests. If you refresh your Silverlight application then this file is cleaned [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
<li><a href='http://www.leggetter.co.uk/2007/02/02/get-windows-temporary-directory.html' rel='bookmark' title='Permanent Link: C# &#8211; Get Windows Temporary Directory'>C# &#8211; Get Windows Temporary Directory</a></li>
<li><a href='http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html' rel='bookmark' title='Permanent Link: How to make a cross domain web request with SilverLight 2'>How to make a cross domain web request with SilverLight 2</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It would appear that the Silverlight runtime <a  href="http://forums.silverlight.net/forums/p/135096/301578.aspx">creates a file named XCP*.tmp of around 20MB within a users %temp% directory</a> (where * can be replaced by random characters). This file would appear to be used in some way by the Silverlight runtime for web requests. If you refresh your Silverlight application then this file is cleaned up. However, if your web request is interrupted in some way then the file can be left in your %temp% directory slowly but surely eating up disk space.</p>
<p>This is particularly noticeable and reproducible if you are using the HttpWebRequest class to stream data (for more <a  href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html">information on streaming data from Silverlight you can listen to my podcast and read my article in a free MSDN book</a>). You can then reproduce the loss of connection using <a  href="http://www.fiddler2.com/fiddler2/">Fiddler</a> (which seriously rocks and is becoming more and more useful) by right-clicking on the streaming connection and selecting &#8220;Abort Session&#8221;.</p>
<div id="attachment_695" class="wp-caption alignnone" style="width: 539px"><a  href="http://www.leggetter.co.uk/wp-content/uploads/2010/02/FiddlerAbortSession.png" class="thickbox no_icon" rel="gallery-691" title="Fiddler - Abort Session"><img class="size-full wp-image-695 " title="Fiddler - Abort Session" src="http://www.leggetter.co.uk/wp-content/uploads/2010/02/FiddlerAbortSession.png" alt="" width="529" height="294" /></a><p class="wp-caption-text">Fiddler - Abort Session</p></div>
<p>The best solution to resolve this that I&#8217;ve found is to manually invoke the garbage collector whenever you detect the connection loss.</p>
<pre class="brush: csharp;">
// Manually invoke Garbage collection
GC.Collect();
</pre><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;title=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Silverlight+uses+XCP+tmp+files+for+Web+Requests+@+http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html&amp;t=Silverlight+uses+XCP+tmp+files+for+Web+Requests" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
<li><a href='http://www.leggetter.co.uk/2007/02/02/get-windows-temporary-directory.html' rel='bookmark' title='Permanent Link: C# &#8211; Get Windows Temporary Directory'>C# &#8211; Get Windows Temporary Directory</a></li>
<li><a href='http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html' rel='bookmark' title='Permanent Link: How to make a cross domain web request with SilverLight 2'>How to make a cross domain web request with SilverLight 2</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MSDN e-book and podcast</title>
		<link>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html</link>
		<comments>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#comments</comments>
		<pubDate>Sun, 03 Jan 2010 17:38:17 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=629</guid>
		<description><![CDATA[A few months back I wrote an article for the UK MSDN Flash newsletter. That article is now available in a free e-book and my podcast interview about the article with Eric Nelson is now also available.


Podcast
Phil Leggetter talks about creating a Silverlight application that consumes real-time data
Here&#8217;s a link to Eric&#8217;s original podcast post.

E-Book
UK [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2009/08/05/book-review-juggle-rethink-work-reclaim-your-life.html' rel='bookmark' title='Permanent Link: Book review: Juggle! Rethink work, reclaim your life'>Book review: Juggle! Rethink work, reclaim your life</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A few months back I wrote an article for the UK MSDN Flash newsletter. That article is now available in a <a  href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#ebook">free e-book</a> and my <a  href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#podcast">podcast</a> interview about the article with <a  href="http://blogs.msdn.com/ericnel/">Eric Nelson</a> is now also available.<br />
<span id="more-629"></span><br />
<a name="podcast"></a></p>
<h3>Podcast</h3>
<p><a href="http://ecn.channel9.msdn.com/o9/ch9/5/7/6/3/1/5/msdnflash016b.mp3">Phil Leggetter talks about creating a Silverlight application that consumes real-time data</a></p>
<p>Here&#8217;s a link to Eric&#8217;s <a  href="http://geekswithblogs.net/iupdateable/archive/2009/12/17/msdn-flash-podcast-016-ndash-phil-leggetter-talks-real-time.aspx">original podcast post</a>.</p>
<p><script src="http://mediaplayer.yahoo.com/js" type="text/javascript"></script></p>
<h3>E-Book</h3>
<div id="__ss_2710377" style="width: 477px; text-align: left;"><a  style="font: 14px Helvetica,Arial,Sans-serif; display: block; margin: 12px 0 3px 0; text-decoration: underline;" title="UK MSDN Flash eBook Best Technical Articles #2 - ericnel" href="http://www.slideshare.net/ukdpe/uk-msdn-flash-e-book-best-technical-articles-2-ericnel">UK MSDN Flash eBook Best Technical Articles #2 &#8211; ericnel</a><object style="margin: 0px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="477" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=ukmsdnflashebookbesttechnicalarticlesnum2-091213141440-phpapp02&amp;stripped_title=uk-msdn-flash-e-book-best-technical-articles-2-ericnel" /><param name="allowfullscreen" value="true" /><embed style="margin: 0px;" type="application/x-shockwave-flash" width="477" height="510" src="http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=ukmsdnflashebookbesttechnicalarticlesnum2-091213141440-phpapp02&amp;stripped_title=uk-msdn-flash-e-book-best-technical-articles-2-ericnel" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a  style="text-decoration: underline;" href="http://www.slideshare.net/">documents</a> from <a  style="text-decoration: underline;" href="http://www.slideshare.net/ukdpe">ukdpe</a>.</div>
</div>
<p>Here&#8217;s a link to Eric&#8217;s <a  href="http://geekswithblogs.net/iupdateable/archive/2009/12/08/free-msdn-flash-ebook-of-the-best-13-technical-articles.aspx">original e-book post</a></p><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;title=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+MSDN+e-book+and+podcast+@+http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html&amp;t=MSDN+e-book+and+podcast" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2009/08/05/book-review-juggle-rethink-work-reclaim-your-life.html' rel='bookmark' title='Permanent Link: Book review: Juggle! Rethink work, reclaim your life'>Book review: Juggle! Rethink work, reclaim your life</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://ecn.channel9.msdn.com/o9/ch9/5/7/6/3/1/5/msdnflash016b.mp3" length="20402139" type="audio/mpeg" />
		</item>
		<item>
		<title>Which Rich Internet Application Technology will dominate?</title>
		<link>http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html</link>
		<comments>http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html#comments</comments>
		<pubDate>Sat, 07 Nov 2009 01:34:29 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[real-time data]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=534</guid>
		<description><![CDATA[I&#8217;ve been a member of the RIA Developers Group on LinkedIn for a short while now and the other day Patrick Bay posted a link to an interesting article on Computer Weekly about the prominence of RIAs. A few comments were posted and then Patrick questioned which RIAs would &#8220;bubble to the top&#8221;.
I think the UI [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Permanent Link: Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/27/using-real-time-web-software-and-technology-to-distribute-events.html' rel='bookmark' title='Permanent Link: Using real-time web software and technology to distribute events'>Using real-time web software and technology to distribute events</a></li>
<li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a member of the <a  href="http://www.linkedin.com/groups?home=&#038;gid=112239&#038;trk=anet_ug_hm">RIA Developers Group</a> on LinkedIn for a short while now and the other day <a  href="http://ca.linkedin.com/in/patrickbay">Patrick Bay</a> posted a link to an interesting <a  href="http://www.computerweekly.com/Articles/2009/11/04/238406/rich-internet-applications-come-to-the-fore.htm">article on Computer Weekly</a> about the prominence of RIAs. A few comments were posted and then Patrick questioned which RIAs would &#8220;bubble to the top&#8221;.</p>
<blockquote><p>I think the UI revolution&#8217;s already here; now we see which ones bubble to the top!</p></blockquote>
<p>This got me thinking about the criteria that may determine which RIA technology would be most successful.</p>
<p>I think there are a number of things that will determine which one will ultimately win, or at least become the dominant choice. At the moment I can think of three categories; <a  href="http://www.leggetter.co.uk/2009/11/07which-rich-internet-application-technology-will-dominate.html#technology-buy-in">Technology buy-in</a>, <a  href="http://www.leggetter.co.uk/2009/11/07which-rich-internet-application-technology-will-dominate.html#development-environment">Development environment</a> and <a  href="http://www.leggetter.co.uk/2009/11/07which-rich-internet-application-technology-will-dominate.html#data-access-capabilities-and-choice">Data access capabilities and choice</a>.<br />
<span id="more-534"></span><br />
<a name="technology-buy-in"></a></p>
<h2>Technology buy-in</h2>
<p>Some companies buy-in to a technology because they have always used that technology. For example, a company that have always used Java will be more likely to opt for the Adobe solution where they can write their server components using Java and their client in Flash/ActionScript/<a href="http://www.adobe.com/products/flex/">Flex</a> (<em>this terminology is still a bit unclear to me. I think this is why Adobe are renaming Flex Builder to Flash Builder</em>) but a company that have traditionally used Microsoft products will undoubtedly go for <a  href="http://silverlight.net/">Silverlight</a>. More traditional web developers, who probably build upon the <a  href="http://en.wikipedia.org/wiki/LAMP_(solution_stack)">LAMP stack</a>, that have been hand coding PHP on the server and JavaScript on the client tend to go for creating RIAs using Ajax.<br />
<a name="development-environment"></a></p>
<h2>Development environment</h2>
<p>I believe that Microsoft have a massive advantage in having <a href="http://www.microsoft.com/visualstudio/en-gb/products/professional/default.mspx">Visual Studio</a> as a server and client IDE. It has it&#8217;s faults but in general it&#8217;s a fantastic development environment. Those choosing Flex (Java -&gt; ActionScript/Flash) will more than likely choose the <a  href="http://www.eclipse.org/">Eclipse IDE</a>, which is powerful, but it&#8217;s ActionScript/Flex development tools are lacking maturity. I&#8217;ve recently used the <a  href="http://labs.adobe.com/technologies/flashbuilder4/">Flash Builder 4 beta</a> and it&#8217;s miles behind Visual Studio in terms of coding productivity features. I&#8217;ve heard that the Flex UI component development features may be better than Visual Studio&#8217;s support for Silverlight UI. The LAMP with Ajax stack suffers much the same problems as Flex with, as far as I know, Eclipse being the IDE of choice and client-side productivity tools still very much in their infancy. It&#8217;s clearly very difficult to write an IDE to enhance JavaScript/Ajax productivity.</p>
<div class="information">I quite frequently develop JavaScript in Eclipse using the <a  href="http://www.aptana.org/">Aptana</a> plugin so I&#8217;d be interested in getting suggestions on other Ajax IDE choices.</div>
<p><a name="data-access-capabilities-and-choice"></a></p>
<h2>Data access capabilities and choice</h2>
<p>I think this has been one of the last things to be considered in the RIA stack. Previously browsers have locked down where you can get your data from. Developers were always trying to implement hacks to allow them to do things such as make a web request to a server on a different domain or <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross-site scripting</a> to implement <a  href="http://ajaxpatterns.org/HTTP_Streaming">HTTP streaming</a>. As the web has opened up to the idea of <a  href="http://en.wikipedia.org/wiki/Mashup_(web_application_hybrid)">Mashups</a>, browser and RIA plugin vendors have had to change their stance on cross site security. It&#8217;s a difficult line to walk but I believe that the technology that makes retrieving data from multiple sources the easiest, without having to go via a proxy, will have a distinct advantage. Flash and Silverlight are winning the race at the moment with Silverlight&#8217;s use of <a  href="http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx">security policy files</a> and Flash&#8217;s support for <a  href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e08.html#WS366737CC-0BD3-47b4-8292-569FB3AA276B">master policy files</a>. For the Ajax solution I still need to research information on <a  href="https://developer.mozilla.org/en/HTTP_access_control">HTTP cross domain access control</a> headers and which browsers have implemented support for them. I still think there will be an argument for mashing up your data on the server and I have a blog post planned on <a  href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">RTRIA</a> server technologies.</p>
<p>The important questions around RIA data are:</p>
<ul>
<li>Which RIA will be more efficient at consuming data?</li>
<li>Which one will prove to be the most capable as a <a  href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">Real-Time Rich Internet Application (RTRIA)</a>?</li>
<li>Will RIA technology vendors try to lock developers into using a client-server technology stack, such as Adobe may be trying to do with <a  href="http://www.adobe.com/products/livecycle/dataservices/">LCDS</a> and Flex, and will this put developers off?</li>
<li>Is decoupling of server and client technology, and communication protocol, important? I think it is, do you?</li>
</ul>
<p>Although RIAs have been around for a while now, as Patrick said, the race to dominate the Rich Internet Application Technology space is on.</p><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;title=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Which+Rich+Internet+Application+Technology+will+dominate%3F+@+http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html&amp;t=Which+Rich+Internet+Application+Technology+will+dominate%3F" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Permanent Link: Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/27/using-real-time-web-software-and-technology-to-distribute-events.html' rel='bookmark' title='Permanent Link: Using real-time web software and technology to distribute events'>Using real-time web software and technology to distribute events</a></li>
<li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>A Real Time Rich Internet Application (RTRIA) Example</title>
		<link>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html</link>
		<comments>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#comments</comments>
		<pubDate>Tue, 03 Nov 2009 20:12:45 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[real-time]]></category>
		<category><![CDATA[real-time data]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[RTRIA]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=423</guid>
		<description><![CDATA[I&#8217;ve just had an article published in the latest UK MSDN Flash newsletter on How to consume real-time data in a Silverlight RIA. As part of writing up the article I developed a sample Real-Time Rich Internet Application (RTRIA) that consumes real-time data from the Twitter real-time data feed. I also put together my first [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Permanent Link: Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just had an article published in the latest <a  href="http://msdn.microsoft.com/en-gb/aa570311.aspx">UK MSDN Flash newsletter</a> on <strong>How to consume real-time data in a Silverlight RIA</strong>. As part of writing up the article I developed a sample <a  title="Real-Time Rich Internet Application" href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">Real-Time Rich Internet Application (RTRIA)</a> that consumes real-time data from the <a  href="http://apiwiki.twitter.com/Streaming-API-Documentation">Twitter real-time data feed</a>. I also put together my first ever <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#screencast">screencast</a>. So, you can start by <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#code">getting hold of the code</a> or <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#screencast">watching the screencast</a>.</p>
<p><a name="code"></a></p>
<h2>The Code</h2>
<p>First, and this is <strong>Important</strong>:</p>
<div class="important">To get the sample application to stream real-time data from the Twitter real-time feed you will need to <a href="http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html">use Fiddler to trick Silverlight into allowing a crossdomain Web Request</a>.</div>
<p>Now that you are aware of that, you will also need the Silverlight development environment. You can get everything you need via the <a  href="http://silverlight.net/getstarted/">Silverlight Getting Started page</a>.</p>
<p>You&#8217;ve now got everything you need to run the <em>RTRIA</em> example. To run the sample application you should set the <em>MSDNFlashRTRIAExample.Web</em> project as the startup project and the <em>MSDNFlashRTRIAExampleTestPage.html</em> page as the startup page.</p>
<div id="attachment_488" class="wp-caption alignnone" style="width: 345px"><img class="size-full wp-image-488" title="Setting up the solution to run the application" src="http://www.leggetter.co.uk/wp-content/uploads/2009/11/SetupForRunning.png" alt="Setting up the solution to run the application" width="335" height="264" /><p class="wp-caption-text">Setting up the solution to run the application</p></div>
<p>If you&#8217;d like to find out a bit more about the code then read on. If you&#8217;d rather jump straight into the code you can download it from the <a  href="http://code.google.com/p/tweetstreamer/">TweetStreamer Google Code project</a>.<br />
<span id="more-423"></span></p>
<h3>The streaming connection</h3>
<p>The following extracts of code may be slightly modified but that has been done to be able to explain what the code does in general a bit better.</p>
<p>The following extract is used to establish a connection to the Twitter real-time data stream using a <a  href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(VS.95).aspx">HttpWebRequest</a>. The important thing to note is the use of <code>request.AllowReadStreamBuffering = false;</code> which is required since we are requesting a streaming feed. Without setting the <a  href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowreadstreambuffering(VS.95).aspx">AllowReadStreamBuffering</a> property to <code>false</code> the <code>ConnectionResponseCallback</code> callback will not be invoked because the response will be continuously buffering.</p>
<p>Since the Twitter real-time data stream requires authentication, and we can&#8217;t set <a  href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.credentials(VS.95).aspx">Credentials</a> on the <code>HttpWebRequest</code> in Silverlight, the browser will prompt the user for a username and password.</p>
<pre class="brush: csharp;">
private const string SPRITZER_URL = &quot;http://stream.twitter.com/1/statuses/sample.json&quot;;

/// &lt;summary&gt;
/// Starts the connection to the Twitter real-time data stream.
/// &lt;/summary&gt;
public void Connect()
{
    this.InternalConnectionStatus = ConnectionStatus.Connecting;

    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(SPRITZER_URL));
        request.AllowReadStreamBuffering = false;
        request.BeginGetResponse(ConnectionResponseCallback, request);
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
        this.InternalConnectionStatus = ConnectionStatus.Disconnected;
    }
}
</pre>
<p>Within the callback method we ensure that we are connected and then call the <code>ReadResponseStream</code> method which will not return until we call <code>Disconnect()</code>.</p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Called when the initial connection has been established.
/// &lt;/summary&gt;
private void ConnectionResponseCallback(IAsyncResult asynchronousResult)
{
    try
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
        using (HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult))
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                this.InternalConnectionStatus = ConnectionStatus.Connected;

                this.ReadResponseStream(request, response);

                if (this.InternalConnectionStatus != ConnectionStatus.Disconnecting)
                {
                    // unexpected status
                    Debug.WriteLine(&quot;unexpected connection status: &quot; + this.InternalConnectionStatus);
                }
            }
            else
            {
                Debug.WriteLine(&quot;unexpected status code: &quot; + response.StatusCode);
            }
        }

        this.InternalConnectionStatus = ConnectionStatus.Disconnected;
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
    }
}
</pre>
<p>In the <code>ReadResponseStream</code> method we continually read the stream until we are interrupted by the user setting the connection status to a value other than <code>ConnectionStatus.Connected</code>, by calling the <code>Disconnect()</code> method, or an exception is thrown whilst reading from the <code>stream</code>. For each read from the stream we parse the data to get the tweets from the real-time data feed in <a  href="http://json.org/">JSON</a> format.</p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Reads the information received from the Twitter real-time data stream.
/// &lt;/summary&gt;
private void ReadResponseStream(HttpWebRequest request, HttpWebResponse response)
{
    byte[] buffer = new byte[65536];
    using (Stream stream = response.GetResponseStream())
    {
        while (this.InternalConnectionStatus == ConnectionStatus.Connected)
        {
            int read = stream.Read(buffer, 0, buffer.Length);
            UTF8Encoding encoding = new UTF8Encoding();
            string data = encoding.GetString(buffer, 0, read);
            ParseResponseChunk(data);
        }

        // need to call request.Abort or the the thread will block at the end of
        // the using block.
        request.Abort();
    }
}
</pre>
<p>The <code>ParseResponseChunk</code> checks the data it&#8217;s passed and ensures that the data contains at least one full status message (tweet). I&#8217;ll not go into the details of that here since it&#8217;s just a matter of string parsing.</p>
<p><small>I chose to use the JSON format simply because the content passed over the wire is smaller than the XML feed. This should mean that the application has to do less work to read all the data. What we really should also do is benchmark the deserialisation of JSON against the deserialisation of XML to see which performs best within a Silverlight application.<br />
</small></p>
<h3>Deserialising the JSON</h3>
<p>The following JavaScript JSON snipped shows an example of a single Tweet that we get back from the Twitter real-time data feed.</p>
<pre class="brush: jscript;">
{
    &quot;in_reply_to_status_id&quot;:9999999,
    &quot;in_reply_to_user_id&quot;:00000000,
    &quot;favorited&quot;:false,
    &quot;in_reply_to_screen_name&quot;:&quot;leggetter&quot;,
    &quot;text&quot;:&quot;@leggetter Wow! A Real-Time Rich Internet Application (RTRIA)&quot;,
    &quot;id&quot;:2820354600,
    &quot;created_at&quot;:&quot;Fri Nov 4 09:39:33 +0000 2009&quot;,
    &quot;truncated&quot;:false,
    &quot;source&quot;:&quot;&lt;a href=\&quot;http:\/\/tweetdeck.com\/\&quot;&gt;TweetDeck&lt;\/a&gt;&quot;
}
</pre>
<p>The JSON can be deserialised as an instance of a C# class using the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute(VS.95).aspx">DataContract</a> attribute on the class and the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute(VS.95).aspx">DataMember</a> attributes on properties.</p>
<pre class="brush: csharp;">
using System;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
using System.ComponentModel;

namespace TweetStreamer
{
    [DataContract]
    public class StatusMessage : IStatusMessage, INotifyPropertyChanged
    {
        [DataMember(Name = &quot;text&quot;)]
        public string Text {get;set}
    }
}
</pre>
<p>A single Tweet, or in TweetStreamer a <code>StatusMessage</code>, can be deserialised using an instance of the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer(VS.95).aspx">DataContractJsonSerializer</a>.</p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Creates a single message from json string.
/// &lt;/summary&gt;
/// &lt;param name=&quot;messageData&quot;&gt;The message data.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static IStatusMessage CreateMessageFromJsonString(string messageData)
{
    Debug.WriteLine(String.Format(&quot;Creating StatusMessage for: {0}&quot;, messageData));

    IStatusMessage message = null;

    using (MemoryStream stream = new MemoryStream(UTF8Encoding.UTF8.GetBytes(messageData)))
    {
        DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(StatusMessage));
        message = ser.ReadObject(stream) as StatusMessage;
    }

    if (string.IsNullOrEmpty(message.Id))
    {
        message = null;
        Debug.WriteLine(&quot;message had no ID. Assuming to be a delete message so nulling message object&quot;);
    }

    return message;
}
</pre>
<h3>Binding the data to the grid</h3>
<p>To bind the data to a DataGrid the grid needs to be defined in XAML. In addition we can specify the properties on the <code>StatusMessage</code> that we want to bind to columns. In the XAML below we are binding the <code>CreatedAtString</code> property to a Time column, a <code>User.ScreenName</code> to a User column, and a <code>Text</code> property to a Message column. Notice the cool binding of <code>User.ScreenName</code>. The <code>StatusMessage.User</code> property returns an instance of another class and we are actually binding to a property on the returned class.</p>
<pre class="brush: xml;">
&lt;data:DataGrid Grid.Row=&quot;0&quot; x:Name=&quot;Tweets&quot; AutoGenerateColumns=&quot;False&quot;&gt;
    &lt;data:DataGrid.Columns&gt;
        &lt;data:DataGridTextColumn Header=&quot;Time&quot;
            Binding=&quot;{Binding CreatedAtString}&quot; /&gt;
        &lt;data:DataGridTextColumn Header=&quot;User&quot;
            Binding=&quot;{Binding User.ScreenName}&quot; /&gt;
        &lt;data:DataGridTextColumn Header=&quot;Message&quot;
            Binding=&quot;{Binding Text}&quot; /&gt;
    &lt;/data:DataGrid.Columns&gt;
&lt;/data:DataGrid&gt;
</pre>
<p>Next, the code to set up the binding and registering for <code>StatusMessage</code> updates using the <code> StatusMessageReceived</code> event. As you many have noticed, the <code>StatusMessage</code> object implements the <a  href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(VS.95).aspx">INotifyPropertyChanged</a> interface. This was used so that we could add each <code>StatusMessage</code> to an <a  href="http://msdn.microsoft.com/en-us/library/ms668604(VS.95).aspx">ObservableCollection&lt;T&gt;</a> and then bind it to a <a  href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid(VS.95).aspx">DataGrid</a> to display the Tweets in real-time.</p>
<pre class="brush: csharp;">
Connection _twitterConnection;
ObservableCollection&lt;IStatusMessage&gt; _messages = new ObservableCollection&lt;IStatusMessage&gt;();
public MainPage()
{
    InitializeComponent();

    Tweets.ItemsSource = _messages;

    _twitterConnection = new Connection();
    _twitterConnection.StatusMessageReceived += new Connection.OnStatusMessageReceivedEventHandler
        (twitterConnection_StatusMessageReceived);
    _twitterConnection.Connect();
}
</pre>
<p>Finally, whenever we get a <code>StatusMessageReceived</code> callback we need to add the new <code>StatusMessage</code> to the <code>ObservableCollection<T></code> collection. <em>This has to be done on the UI thread and via the <code>Tweets.ItemsSource</code> property or the UI will not update.</em></p>
<pre class="brush: csharp;">
/// &lt;summary&gt;
/// Status message received event handler.
/// &lt;/summary&gt;
/// &lt;param name=&quot;sender&quot;&gt;&lt;/param&gt;
/// &lt;param name=&quot;args&quot;&gt;&lt;/param&gt;
void twitterConnection_StatusMessageReceived(object sender, IStatusMessageReceivedEventArgs args)
{
    Dispatcher.BeginInvoke(() =&gt;
        AddMessage(args.Message)
    );
}

/// &lt;summary&gt;
/// Adds a message to the observable message list which updates the UI.
/// &lt;/summary&gt;
/// &lt;param name=&quot;message&quot;&gt;&lt;/param&gt;
void AddMessage(IStatusMessage message)
{
    ObservableCollection&lt;IStatusMessage&gt; messageList = ((ObservableCollection&lt;IStatusMessage&gt;)Tweets.ItemsSource);
    messageList.Insert(0, message);
}
</pre>
<p>Hopefully this will have helped you understand how the Twitter real-time data stream is consumed and an example of how you can use it within a <strong>Real-Time Rich Internet Application</strong>. Now, why now <a  href="http://code.google.com/p/tweetstreamer/">download the TweetStreamer library and example application</a> and have a play.</p>
<div class="information"><strong>Limitations</strong>: Although I&#8217;ve seen the sample application perform reasonably well I&#8217;ve also seen it perform quite poorly. How well it performs will depend on the machine running the application and the frequency of the updates from the real-time Twitter stream. In later posts I&#8217;ll provide information on how to improve performance by making changes to the client code and I&#8217;ll also go into what can be done on the server.</div>
<h3>Download</h3>
<p>You can download the source from the <a  href="http://code.google.com/p/tweetstreamer/">TweetStreamer Google Code project</a>.<br />
<a name="screencast"></a></p>
<h2>Screencast</h2>
<p>This screencast was supposed to be short but ended up being just shy of 10 minutes. In it I provide some technical detail of how I built the application, show the basics of how Fiddler is used to give access to the Twitter real-time data stream, and give a demo of the application.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="625" height="505" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/5T_jiZCzg4U&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="625" height="505" src="http://www.youtube.com/v/5T_jiZCzg4U&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;title=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example+@+http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html&amp;t=A+Real+Time+Rich+Internet+Application+%28RTRIA%29+Example" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Permanent Link: Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</title>
		<link>http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html</link>
		<comments>http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html#comments</comments>
		<pubDate>Fri, 30 Oct 2009 11:06:06 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[real-time]]></category>
		<category><![CDATA[real-time data]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[RTRIA]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=425</guid>
		<description><![CDATA[If you are trying to make a web request from a Silverlight application the first thing the Silverlight runtime will do is request a security policy file (see Network Security Access Restrictions in Silverlight) from the root of the server you are making your web request to. This happens if you are making your request [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html' rel='bookmark' title='Permanent Link: How to make a cross domain web request with SilverLight 2'>How to make a cross domain web request with SilverLight 2</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you are trying to make a web request from a Silverlight application the first thing the Silverlight runtime will do is request a security policy file (see <a  href="http://msdn.microsoft.com/en-us/library/cc645032(VS.95).aspx">Network Security Access Restrictions in Silverlight</a>) from the root of the server you are making your web request to. This happens if you are making your request using the <a  href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(VS.95).aspx">HttpWebRequest</a> or <a  href="http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.95).aspx">WebClient</a> class. If the Silverlight runtime fails to get a security policy file your web request will fail. If your Silverlight application relies on this web request then you are going to need to contact the server owner and get them to add a security file but until then you can use the <a  href="http://www.fiddler2.com/fiddler2/">Fiddler HTTP Proxy</a> to trick the Silverlight runtime into believing that it does have permission to make the request.<br />
<span id="more-425"></span><br />
<small>If you want to skip the explanation you can jump <a  href="#screencast">straight to the screencast</a></small></p>
<h2>How Silverlight makes a web request</h2>
<p>If you were making a web request from Silverlight to download the following page:</p>
<p><code><a  href="http://www.leggetter.co.uk/2009/10/23/how-i-approach-problem-solving-in-code.html" rel="nofollow">http://www.leggetter.co.uk/2009/10/23/how-i-approach-problem-solving-in-code.html</a></code></p>
<p>The Silverlight runtime would first request</p>
<p><code><a  href="http://www.leggetter.co.uk/clientaccesspolicy.xml" rel="nofollow">http://www.leggetter.co.uk/clientaccesspolicy.xml</a></code></p>
<p>If this request fails it will then request</p>
<p><code><a  href="http://www.leggetter.co.uk/crossdomain.xml" rel="nofollow">http://www.leggetter.co.uk/crossdomain.xml</a></code></p>
<p>If both of these requests fail (return a 404 HTTP status) the Silverlight runtime will not allow you to make your web request. *</p>
<p><small>* Note: The web request failure due to a failure to download a security policy file can manifest itself in a number of ways. I&#8217;ll try to remember to put a post up about this later.</small></p>
<p>The clientaccesspolicy.xml file is Microsoft&#8217;s own security policy file. The crossdomain.xml file is used by Adobe Flash but is also supported by Silverlight. For more information see <a  href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e08.html#WS366737CC-0BD3-47b4-8292-569FB3AA276B">master-policy file</a>.</p>
<p>Now that we&#8217;ve got the background information out of the way we can get on to the interesting stuff.</p>
<h2>An example using the Twitter Streaming Feed</h2>
<p>If you wanted to write your own <a  href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">Real-Time Rich Internet Application (RTRIA)</a> that consumed data from the <a  href="http://apiwiki.twitter.com/Streaming-API-Documentation">Twitter real-time data stream</a> you&#8217;d be stuck. Well, you&#8217;ll be stuck until Twitter puts a security policy file up **. Until then you can trick the Silverlight runtime by using <a  href="http://www.fiddler2.com/fiddler2/">Fiddler</a> to detect the security policy file request and fake a response.</p>
<p><small>**  The following URLs are where Twitter would put their security policy files should they decide to allow cross domain access. Please not that you&#8217;ll be prompted for your Twitter username and password if you click on them by the browser because you need to sign in with valid twitter credentials to access the twitter <em>stream</em> domain: <a  href="http://stream.twitter.com/clientaccesspolicy.xml" rel="nofollow">http://stream.twitter.com/clientaccesspolicy.xml</a> and <a  href="http://stream.twitter.com/crossdomain.xml)" rel="nofollow">http://stream.twitter.com/crossdomain.xml)</a></small></p>
<p>To do this you will need to set up an <a  href="http://www.fiddler2.com/Fiddler2/help/AutoResponder.asp">AutoResponder</a> in Fiddler that intercepts the request for the security policy file by the Silverlight runtime and returns a fake security policy file. In the example below I have an AutoResponder set up for <code><a  href="http://stream.twitter.com/crossdomain.xml" rel="nofollow">http://stream.twitter.com/crossdomain.xml</a></code>.</p>
<div id="attachment_426" class="wp-caption alignnone" style="width: 310px"><a  title="Using Fiddler to AutoRespond with a fake Security Policy File " href="http://www.leggetter.co.uk/wp-content/uploads/2009/10/UsingFiddlerToAutoRespondWithAFakeSecurityPolicyFile.png" class="thickbox no_icon" rel="gallery-425"><img class="size-medium wp-image-426 " title="UsingFiddlerToAutoRespondWithAFakeSecurityPolicyFile" src="http://www.leggetter.co.uk/wp-content/uploads/2009/10/UsingFiddlerToAutoRespondWithAFakeSecurityPolicyFile-300x195.png" alt="Using Fiddler to AutoRespond with a fake Security Policy File" width="300" height="195" /></a><p class="wp-caption-text">Using Fiddler to AutoRespond with a fake Security Policy File</p></div>
<p>Here&#8217;s an example of a crossdomain.xml security policy file which grants access to requests from all domains.</p>
<pre>&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE cross-domain-policy
  SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
&lt;cross-domain-policy&gt;
  &lt;allow-access-from domain="*" /&gt;
&lt;/cross-domain-policy&gt;</pre>
<p>Once you&#8217;ve set up the AutoResponder start Fiddler. Then start your Silverlight application that is trying to stream data from Twitter and bingo! You should have real-time data from Twitter in your RIA &#8211; a Real-Time Rich Internet Application (RTRIA).</p>
<p><a name="screencast"></a></p>
<h2>Fiddler HTTP Proxy Screencast</h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/NXSmH9aWxeo&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/NXSmH9aWxeo&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;feature=player_embedded&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;title=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request+@+http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html&amp;t=Using+Fiddler+to+trick+Silverlight+into+allowing+a+crossdomain+Web+Request" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html' rel='bookmark' title='Permanent Link: How to make a cross domain web request with SilverLight 2'>How to make a cross domain web request with SilverLight 2</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Real-Time Rich Internet Applications (RTRIA)</title>
		<link>http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html</link>
		<comments>http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html#comments</comments>
		<pubDate>Thu, 29 Oct 2009 10:15:06 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[pubsubhubbub]]></category>
		<category><![CDATA[real-time]]></category>
		<category><![CDATA[real-time data]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[rssCloud]]></category>
		<category><![CDATA[RTRIA]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=456</guid>
		<description><![CDATA[Real-Time Rich Internet Applications (RTRIAs) are RIAs that consume and display real-time data. They have all the characteristics of an RIA with the added feature that data is being pushed to them in real-time as soon as it becomes available. This is in contrast to the current polling solution employed by most RIAs or other [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2009/12/01/the-christmascrunch-nearly-real-time-web-event.html' rel='bookmark' title='Permanent Link: The ChristmasCrunch nearly real-time web event'>The ChristmasCrunch nearly real-time web event</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/14/why-comet-is-key-to-the-truly-real-time-web.html' rel='bookmark' title='Permanent Link: Why Comet is key to the Truly Real-Time Web'>Why Comet is key to the Truly Real-Time Web</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>Real-Time Rich Internet Applications</strong> (<strong>RTRIA</strong>s) are <a  href="http://en.wikipedia.org/wiki/Rich_Internet_application">RIA</a>s that consume and display real-time data. They have all the characteristics of an RIA with the added feature that data is being pushed to them in real-time as soon as it becomes available. This is in contrast to the current polling solution employed by most RIAs or other web applications that display updating data.</p>
<p>I mentioned <strong>RTRIA</strong>s for the first time back in April 2009 in a post called &#8220;<a  href="http://blog.caplin.com/2009/04/20/what-is-the-real-time-web/">What is the real-time web</a>&#8221; on the Caplin Systems Platformability blog, and since then there has been a real-time web explosion. The &#8220;real-time web&#8221; is now <strong>the</strong> buzz phrase around the Internet that everybody is jumping on. Back in April I set up a <a  href="http://www.google.com/alerts">Google Alert</a> for the term &#8220;real-time web&#8221;. Back then I got maybe one Google Alert a day for this term, probably less. Now, I get at least two dense emails a day from Google with people using the term for all sorts of things; real-time web stats, real-time analytics, real-time search, <a  href="http://rsscloud.org/">rssCloud</a>, <a  href="http://code.google.com/p/pubsubhubbub/">pubsubhubbub</a>, the list goes on. <em>This is not the real-time web!</em> Whilst some of the things on this list will help  the web become <em>truly real-time</em> (rssCloud and pubsubhubbub may even form the back bone), none of these things give the user a truly real-time web experience.</p>
<p><span id="more-456"></span></p>
<p>My opinion about what the real-time web is has not changed from that <a  href="http://blog.caplin.com/2009/04/20/what-is-the-real-time-web/">first blog post</a>. For me, it&#8217;s not just about <em>data being available</em> as soon as it&#8217;s been published. In this situation the user still has to actively make a request to see if any data is available. Instead it&#8217;s about making a single request for data (a <em>subscription</em>) and that data being pushed to your RIA to be consumed by the application user in real-time. Quite a few applications have implemented a polling solution (more on this later) but the experience presented to the user is not <em>truly real-time</em>.</p>
<div id="attachment_463" class="wp-caption alignnone" style="width: 669px"><a  href="http://www.leggetter.co.uk/wp-content/uploads/2009/10/real-time-web-twitter-search.png" class="thickbox no_icon" rel="gallery-456" title="Twitter &quot;real-time web&quot; search results"><img class="size-full wp-image-463" title="Twitter &quot;real-time web&quot; search results" src="http://www.leggetter.co.uk/wp-content/uploads/2009/10/real-time-web-twitter-search.png" alt="&quot;Real-Time&quot;" width="659" height="429" /></a><p class="wp-caption-text">&quot;Real-Time?&quot;</p></div>
<p>In my opinion the only way to guarantee being able to deliver <em>truly real-time data</em> (<strong>TRTD</strong>) to a web application is by maintaining a streaming connection to the source of the data using a <em>continuous</em> streaming HTTP connection. Most web applications use a technique called polling or <a  href="http://en.wikipedia.org/wiki/Push_technology#Long_polling">long polling</a> to retrieve their data which means that although the data is initially &#8220;fresh&#8221;, within seconds it could be out of date, or more information may be available. I&#8217;ll discuss server technologies further in a later post.</p>
<p>At the moment there are a number of technologies that allow you to develop RTRIAs. <a  href="http://en.wikipedia.org/wiki/Ajax_(programming)">Ajax</a>, <a  href="http://www.microsoft.com/SILVERLIGHT/overview/default.aspx">Silverlight</a> and <a  href="http://www.adobe.com/flashplatform/">Flash</a> are the three mainstream solutions. The core barriers to RTRIAs are the scalability of server technology and access to truly real-time data.</p><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;title=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Real-Time+Rich+Internet+Applications+%28RTRIA%29+@+http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html&amp;t=Real-Time+Rich+Internet+Applications+%28RTRIA%29" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Permanent Link: Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2009/12/01/the-christmascrunch-nearly-real-time-web-event.html' rel='bookmark' title='Permanent Link: The ChristmasCrunch nearly real-time web event'>The ChristmasCrunch nearly real-time web event</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/14/why-comet-is-key-to-the-truly-real-time-web.html' rel='bookmark' title='Permanent Link: Why Comet is key to the Truly Real-Time Web'>Why Comet is key to the Truly Real-Time Web</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to make a cross domain web request with SilverLight 2</title>
		<link>http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html</link>
		<comments>http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html#comments</comments>
		<pubDate>Fri, 24 Oct 2008 12:16:18 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[crossdomain]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=60</guid>
		<description><![CDATA[To make a cross domain web request with SilverLight 2 really isn&#8217;t that tough. I did have some problems with RC0 but I have no idea why. I just tried writing a little app to do this and it worked straight away.

Here&#8217;s the code. It&#8217;s obviously part of a full solution containing a Web Application [...]


Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
<li><a href='http://www.leggetter.co.uk/2007/02/04/how-much-is-your-domain-worth.html' rel='bookmark' title='Permanent Link: How much is your domain worth?'>How much is your domain worth?</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>To make a cross domain web request with SilverLight 2 really isn&#8217;t that tough. I did have some problems with RC0 but I have no idea why. I just tried writing a little app to do this and it worked straight away.<br />
<span id="more-60"></span></p>
<p>Here&#8217;s the code. It&#8217;s obviously part of a full solution containing a Web Application and a SilverLight Application project. I&#8217;ve also <a  href="http://www.leggetter.co.uk/wp-content/uploads/2008/10/silverlightcrossdomainapplication.zip">uploaded it</a>.</p>
<h2>Useful Information:</h2>
<ul>
<li>You <strong>can not</strong> do a cross domain request over HTTPS.</li>
<li>You <strong>can</strong> do a cross domain request over HTTP.</li>
<li>To be able to make the cross domain request the server that you are making the request to needs to have either (requires clarification) <a  href="http://www.leggetter.co.uk/crossdomain.xml"> crossdomain.xml</a> and/or <a  href="http://www.leggetter.co.uk/clientaccesspolicy.xml">clientaccesspolicy.xml</a> in the root of the webserver.</li>
</ul>
<h2>Resources/links:</h2>
<div>
<ul>
<li><a  href="http://silverlight.net/forums/p/35194/106059.aspx#106059">SilverLight.net forum post on making a WCF cross domain request</a></li>
<li><a  href="http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx">Cross domain policy file helpers for Visual Studio</a> &#8211; addes intellisense for the XML files</li>
<li><a  href="http://www.franksworld.com/Utilities/CrossDomainPolicyChecker/Default.aspx">Online cross domain policy file checker</a></li>
<li><a  href="http://www.leggetter.co.uk/wp-content/uploads/2008/10/silverlightcrossdomainapplication.zip">Silverlight cross domain web request example solution</a></li>
<li><a  href="http://www.leggetter.co.uk/crossdomain.xml">Example clientpolicy.xml</a> file<a  href="http://www.leggetter.co.uk/clientaccesspolicy.xml"></a></li>
<li><a href="http://www.leggetter.co.uk/clientaccesspolicy.xml">Example clientaccesspolicy.xml</a> file</li>
</ul>
</div>
<h2>The code:</h2>
<pre class="brush: csharp;">
private void RequestButton_Click(object sender, RoutedEventArgs e)
{
    try
    {
        // Create and being making the request/getting the response
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(&quot;http://www.leggetter.co.uk/&quot;));
        request.BeginGetResponse(HandleResponse, request);
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
    }
}

private void HandleResponse(IAsyncResult result)
{
    try
    {
        // Finish getting the response and then read the response in chunks
        HttpWebRequest request = (HttpWebRequest)result.AsyncState;
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);

        StringBuilder readText = new StringBuilder();
        using (Stream responseStream = response.GetResponseStream())
        {
            byte[] buffer = new byte[1024];
            int read = responseStream.Read(buffer, 0, buffer.Length);
            while (read &gt; 0)
            {
                readText.Append(Encoding.UTF8.GetString(buffer, 0, read));
                read = responseStream.Read(buffer, 0, buffer.Length);
            }
        }

        // Display the response text
        Dispatcher.BeginInvoke(delegate()
        {
            ResponseText.Text = readText.ToString();
        });
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
    }
}
</pre><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em> </em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;title=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+How+to+make+a+cross+domain+web+request+with+SilverLight+2+@+http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html&amp;t=How+to+make+a+cross+domain+web+request+with+SilverLight+2" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://www.leggetter.co.uk/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>Related posts:<ol><li><a href='http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html' rel='bookmark' title='Permanent Link: Using Fiddler to trick Silverlight into allowing a crossdomain Web Request'>Using Fiddler to trick Silverlight into allowing a crossdomain Web Request</a></li>
<li><a href='http://www.leggetter.co.uk/2007/02/04/how-much-is-your-domain-worth.html' rel='bookmark' title='Permanent Link: How much is your domain worth?'>How much is your domain worth?</a></li>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Permanent Link: Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2008/10/24/how-to-make-a-cross-domain-web-request-with-silverlight-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
