<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Qcsdev&#039;s Blog</title>
	<atom:link href="http://qcsdev.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://qcsdev.wordpress.com</link>
	<description>Blogging the challenges and thoughts of a Developer</description>
	<lastBuildDate>Fri, 21 Aug 2009 14:09:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='qcsdev.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Qcsdev&#039;s Blog</title>
		<link>http://qcsdev.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://qcsdev.wordpress.com/osd.xml" title="Qcsdev&#039;s Blog" />
	<atom:link rel='hub' href='http://qcsdev.wordpress.com/?pushpress=hub'/>
		<item>
		<title>ASP.NET AJAX and the Proxy Pattern</title>
		<link>http://qcsdev.wordpress.com/2009/08/21/asp-net-ajax-and-the-proxy-pattern/</link>
		<comments>http://qcsdev.wordpress.com/2009/08/21/asp-net-ajax-and-the-proxy-pattern/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 13:22:58 +0000</pubDate>
		<dc:creator>Quintin de Kok</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Google Spell Checker]]></category>
		<category><![CDATA[Mash It Up]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Spell Cheking]]></category>
		<category><![CDATA[XmlHTTP]]></category>

		<guid isPermaLink="false">http://qcsdev.wordpress.com/?p=15</guid>
		<description><![CDATA[Introduction As promised, the first article for my blog has arrived. I was asked by a client to add spell checker functionality to line of business application written in C# ASP.NET and AJAX. I went on a Google rampage trying to find a free spell checker that would do the job properly. There are tons [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=qcsdev.wordpress.com&amp;blog=8993996&amp;post=15&amp;subd=qcsdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:medium;">Introduction</span></strong></p>
<p>As promised, the first article for my blog has arrived. I was asked by a client to add spell checker functionality to line of business application written in C# ASP.NET and AJAX. I went on a Google rampage trying to find a free spell checker that would do the job properly. There are tons of spell checker implementations for ASP.NET out there developed by some of the leading dev companies. The problem is I couldn’t find a free implementation that looked good and worked well. So I decided that I needed to find a pure JScript implementation of a spell checker and use that instead.</p>
<p>After searching a while I got the <a href="http://orangoo.com/labs/GoogieSpell/">Orangoo</a> AJAX implementation of a <a href="http://orangoo.com/labs/GoogieSpell/">Google like spell checker</a> that uses the <a href="http://www.loresoft.com/projects/netspell/google-toolbar-spell-check-api/">Google Toolbar Spell Check API</a> that was reverse engineered from the Google toolbar; a hack I know but; why not!</p>
<p>I was able to get the <a href="http://orangoo.com/labs/uploads/googiespell_v4_0.zip">demo</a> of the implementation working immediately after download, open the demo_single.html file and viola, it works. When I ported it to ASP.NET I was hit by a curve ball called the “same domain policy”. In short; JavaScript from one host (<a href="http://yourhost.com">http://yourhost.com</a>) cannot access a web service using XmlHTTP on another host (<a href="http://otherhost.com">http://otherhost.com</a>) due to security concerns etc. You have basically got 2 options that you can use, JSONP (which is way out of my league) or you can implement a proxy pattern, also known as (Mash It Up), where a web service is called on your domain (<a href="http://yourhost.com/service">http://yourhost.com/service</a>) and it, in turn, accesses the remote host and returns the data to your page. The proxy pattern has many advantages but ease of implementation remains the greatest.</p>
<p>To implement a XmlHTTP proxy you can either create an elaborate web service that takes the requested information and passed it on with security etc. or you create a very simple page that proxy’s for you, assuming that you’ve used Windows or Forms authentication to reach the page as a security measure.</p>
<p>Then it’s as simple as adding the following to your page load event:</p>
<div style="width:422px;display:block;float:none;margin-left:auto;margin-right:auto;padding:5px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d0effde7-73e8-4711-a844-b9fdef92cdd8" class="wlWriterEditableSmartContent">
<div style="border:#000080 1px solid;font-family:'Courier New', Courier, Monospace;font-size:10pt;">
<div style="background:#ddd;max-height:300px;overflow:scroll;padding:0;">
<ol style="background:#ffffff;white-space:nowrap;margin:0 0 0 35px;">
<li>     <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Page_Load()</li>
<li>     {</li>
<li>         <span style="color:#008000;">// create the web request to the remote server</span></li>
<li>         System.Net.<span style="color:#2b91af;">WebRequest</span> webRequest = </li>
<li>             System.Net.<span style="color:#2b91af;">HttpWebRequest</span>.Create(</li>
<li>                 <span style="color:#0000ff;">string</span>.Format(<span style="color:#a31515;">@&#8221;https://www.google.com/tbproxy/spell?lang={0}&#8221;</span>, </li>
<li>                     (<span style="color:#0000ff;">this</span>.Request.QueryString[<span style="color:#a31515;">"lang"</span>] == <span style="color:#a31515;">&#8220;&#8221;</span> ? <span style="color:#a31515;">&#8220;en&#8221;</span> : <span style="color:#0000ff;">this</span>.Request.QueryString[<span style="color:#a31515;">"lang"</span>])));</li>
<li> </li>
<li>         <span style="color:#008000;">// populate request with the method (GET/POST) and content type</span></li>
<li>         webRequest.Method = <span style="color:#0000ff;">this</span>.Request.HttpMethod;</li>
<li>         webRequest.ContentType = <span style="color:#0000ff;">this</span>.Request.ContentType;</li>
<li> </li>
<li>         <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">this</span>.Request.HttpMethod == <span style="color:#a31515;">&#8220;POST&#8221;</span>)</li>
<li>         {</li>
<li>             <span style="color:#008000;">// populate request with input steam in case of POST</span></li>
<li>             <span style="color:#0000ff;">using</span> (System.IO.<span style="color:#2b91af;">StreamReader</span> requestStream = <span style="color:#0000ff;">new</span> System.IO.<span style="color:#2b91af;">StreamReader</span>(<span style="color:#0000ff;">this</span>.Request.InputStream))</li>
<li>             {</li>
<li>                 System.IO.<span style="color:#2b91af;">StreamWriter</span> requestWriter = <span style="color:#0000ff;">new</span> System.IO.<span style="color:#2b91af;">StreamWriter</span>(webRequest.GetRequestStream());</li>
<li>                 requestWriter.Write(requestStream.ReadToEnd());</li>
<li>                 requestWriter.Flush();</li>
<li>                 requestWriter.Close();</li>
<li>                 requestStream.Close();</li>
<li>             }</li>
<li>         }</li>
<li> </li>
<li>         <span style="color:#008000;">// get the reponse from the remote server</span></li>
<li>         System.Net.<span style="color:#2b91af;">WebResponse</span> webResponse = webRequest.GetResponse();</li>
<li> </li>
<li>         <span style="color:#008000;">// set the encoding for the response</span></li>
<li>         <span style="color:#2b91af;">Encoding</span> encode = System.Text.<span style="color:#2b91af;">Encoding</span>.GetEncoding(<span style="color:#a31515;">&#8220;utf-8&#8243;</span>);</li>
<li> </li>
<li>         <span style="color:#008000;">// create the Stream Reader</span></li>
<li>         System.IO.<span style="color:#2b91af;">StreamReader</span> responseStream = <span style="color:#0000ff;">new</span> System.IO.<span style="color:#2b91af;">StreamReader</span>(webResponse.GetResponseStream(), encode);</li>
<li>         </li>
<li>         <span style="color:#008000;">// write xml response</span></li>
<li>         <span style="color:#0000ff;">this</span>.Response.ContentType = webResponse.ContentType;</li>
<li>         <span style="color:#0000ff;">this</span>.Response.Write(responseStream.ReadToEnd());</li>
<li>     \</li>
</ol>
</div>
</div>
</div>
<p>That’s that, you’ve successfully created an XmlHTTP proxy for a google spell checker that could be used for any Mash It Up scenario. Please see my disclaimer here…</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qcsdev.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qcsdev.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qcsdev.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=qcsdev.wordpress.com&amp;blog=8993996&amp;post=15&amp;subd=qcsdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://qcsdev.wordpress.com/2009/08/21/asp-net-ajax-and-the-proxy-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be439fab34d68dcac63616a83cdcf78e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">qcsdev</media:title>
		</media:content>
	</item>
		<item>
		<title>So we get started!</title>
		<link>http://qcsdev.wordpress.com/2009/08/14/so-we-get-started/</link>
		<comments>http://qcsdev.wordpress.com/2009/08/14/so-we-get-started/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 07:51:18 +0000</pubDate>
		<dc:creator>Quintin de Kok</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[de Kok]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quintin]]></category>

		<guid isPermaLink="false">http://qcsdev.wordpress.com/2009/08/14/so-we-get-started/</guid>
		<description><![CDATA[I was listening to .NET Rocks podcast episode #467 and got a reference to a site created by Microsoft for developers during these tough economic times, Thrive. The site means to give developers the skill sets to place themselves above the rest. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=qcsdev.wordpress.com&amp;blog=8993996&amp;post=4&amp;subd=qcsdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let me start by giving some information about myself. My name is Quintin de Kok, a Development Director in a small development house called <a href="http://www.qcsolutions.co.za">QC Solutions</a> in Pretoria, South Africa focussing on development in .NET although we often take on Open Source support projects. I have a wife of a few years now and we recently added a little girl to our family.</p>
<p>I was listening to <a href="http://www.franklins.net">.NET Rocks</a> podcast episode #467 and got a reference to a site created by Microsoft for developers during these tough economic times, <a href="http://www.msdnevents.com/thrivedev">Thrive</a>. The site means to give developers the skill sets to place themselves above the rest.</p>
<p>I then had an look at an interesting video of a talk given by Scott Hanselman at Devscovery <a href="http://neuronspark.com/videos/social-networking-for-developers/">here…</a> </p>
<p>I agreed with most of what Scott said and I figured what the hey, let’s start a blog!</p>
<p>So, I’m going to make a concerted effort to blog some interesting challenges and articles for you to view, reference and use as you wish. Leave me a comment if you’d like to get in contact or check out the contact details on our site <a href="http://www.qcsolutions.co.za">here…</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/qcsdev.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/qcsdev.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/qcsdev.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=qcsdev.wordpress.com&amp;blog=8993996&amp;post=4&amp;subd=qcsdev&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://qcsdev.wordpress.com/2009/08/14/so-we-get-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/be439fab34d68dcac63616a83cdcf78e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">qcsdev</media:title>
		</media:content>
	</item>
	</channel>
</rss>
