<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Others</title><link>http://blogs.clearscreen.com/jfbonnin/category/190.aspx</link><description>Others</description><managingEditor>Jose Fco. Bonnin</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Farewell</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2008/07/23/13263.aspx</link><pubDate>Wed, 23 Jul 2008 06:37:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2008/07/23/13263.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/13263.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2008/07/23/13263.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/13263.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/13263.aspx</trackback:ping><description>&lt;p&gt;After some time blogging at Clearscreen I've decided to stop writing (and not writing) here and,  following the current trend, start a new adventure on my own at &lt;a href="http://www.josefcobonnin.com"&gt;www.josefcobonnin.com&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;I would like to think the new Mad about .NET will be a much more interesting place where I will not repeat some of the mistakes done here, unfortunately the blogger will be the same, therefore I guess I will need to continue learning along the way :)&lt;/p&gt;
&lt;p&gt;I want to thank Clearscreen and Miguel Jimenez for his support and patience during my time here.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Jose.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/13263.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>After some time blogging at Clearscreen I've decided to stop writing (and not writing) here and,  following the current trend, start a new adventure on my own at <a href="http://www.josefcobonnin.com">www.josefcobonnin.com</a>. </p>
<p>I would like to think the new Mad about .NET will be a much more interesting place where I will not repeat some of the mistakes done here, unfortunately the blogger will be the same, therefore I guess I will need to continue learning along the way :)</p>
<p>I want to thank Clearscreen and Miguel Jimenez for his support and patience during my time here.</p>
<p>Regards,</p>
<p>Jose.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/13263.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Hiring people</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/21/11350.aspx</link><pubDate>Mon, 21 Jan 2008 14:58:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/21/11350.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/11350.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/21/11350.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/11350.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/11350.aspx</trackback:ping><description>&lt;p&gt;My last post was related to the answers we received to basic questions we do when somebody applies for a job in our company.&lt;/p&gt;
&lt;p&gt;I shared a couple of them I've found funny or curious, obviously I never would reveal the author of the answers.&lt;/p&gt;
&lt;p&gt;My intention was just to show the weird answers you can receive, like one who answered to "what is Managed Execution?" saying he only works as freelance and specifying the price per hour.&lt;/p&gt;
&lt;p&gt;I never intended to laugh about the people itself, I know how hard can be to look for a job, but just about the rarity of the answers. The prove of this is that among the answers provided, there was one of a current employee and he didn't see any problem I published on the web.&lt;/p&gt;
&lt;p&gt;Our company is a bit special for this kind of things, we are very self-critics and we apply the humor to our daily work with things like hanging with full name the most stupid errors in our intranet, forcing the ones who break more often the builds to bring a handmade dessert, etc.&lt;/p&gt;
&lt;p&gt;The thing is that I received one comment saying the post was not very ethical. In my opinion it was totally misinterpreted, but if one person thought that, it's possible there is more people thinking in the same way, as I said this was far away from my intention. &lt;/p&gt;
&lt;p&gt;Therefore I decided to simply delete the post.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/11350.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>My last post was related to the answers we received to basic questions we do when somebody applies for a job in our company.</p>
<p>I shared a couple of them I've found funny or curious, obviously I never would reveal the author of the answers.</p>
<p>My intention was just to show the weird answers you can receive, like one who answered to "what is Managed Execution?" saying he only works as freelance and specifying the price per hour.</p>
<p>I never intended to laugh about the people itself, I know how hard can be to look for a job, but just about the rarity of the answers. The prove of this is that among the answers provided, there was one of a current employee and he didn't see any problem I published on the web.</p>
<p>Our company is a bit special for this kind of things, we are very self-critics and we apply the humor to our daily work with things like hanging with full name the most stupid errors in our intranet, forcing the ones who break more often the builds to bring a handmade dessert, etc.</p>
<p>The thing is that I received one comment saying the post was not very ethical. In my opinion it was totally misinterpreted, but if one person thought that, it's possible there is more people thinking in the same way, as I said this was far away from my intention. </p>
<p>Therefore I decided to simply delete the post.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/11350.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>2007 Blog Summary</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/07/11227.aspx</link><pubDate>Mon, 07 Jan 2008 20:06:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/07/11227.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/11227.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2008/01/07/11227.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/11227.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/11227.aspx</trackback:ping><description>&lt;p&gt;I initiated this blog one year ago with the intention to write basically about .NET. I started very enthusiastic and having clear that I didn't want to write just about which products come out or what other blogger said before. But reviewing the posts of this past year I've figured out that I've not been as prolific as I would like and that some of my posts really suck. I mean, I already knew it but when you see the numbers is when you face the truth (I only reached an average of 3 posts per month). I guess that sometimes one does not have time enough and/or just does not find the right inspiration, in any case below you can see my top 10 list of posts based on the web visits received. Obviously the "post competition" is not fair, since the oldest the post is the more possibilities has to be visited, but doesn't really matter.&lt;/p&gt;
&lt;p&gt;By the way, I don't understand why the number one received this amazing amount of web visits, who knows what people expected to find when searching how to hook a keyboard and mouse ;)&lt;/p&gt;
&lt;table cellspacing="0" cellpadding="2" width="687" border="2"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="148"&gt;&lt;strong&gt;&lt;font size="2"&gt;Position&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="359"&gt;&lt;strong&gt;&lt;font size="2"&gt;Post&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;strong&gt;&lt;font size="2"&gt;Web Visits&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;strong&gt;&lt;font size="2"&gt;Agg Visits&lt;/font&gt;&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="148"&gt;&lt;font size="2"&gt;1&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="356"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/06/20/6494.aspx"&gt;&lt;font size="2"&gt;Hook Keyboard and Mouse&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;8263&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;341&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="148"&gt;&lt;font size="2"&gt;2&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="354"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/09/6275.aspx"&gt;&lt;font size="2"&gt;C# 3.0 - Object and Collection Initializers&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;1954&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;208&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="146"&gt;&lt;font size="2"&gt;3&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="352"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/16/6298.aspx"&gt;&lt;font size="2"&gt;Artificial Intelligence, bot and Live Messenger Add-In&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;1737&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;444&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="146"&gt;&lt;font size="2"&gt;4&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="350"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/12/6287.aspx"&gt;&lt;font size="2"&gt;C# 3.0 - Lambda Expressions&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;1700&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;395&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="145"&gt;&lt;font size="2"&gt;5&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="349"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/07/08/6579.aspx"&gt;&lt;font size="2"&gt;Google Safe Browsing API with Internet Explorer&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;1164&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;330&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="147"&gt;&lt;font size="2"&gt;6&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="348"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/08/6271.aspx"&gt;&lt;font size="2"&gt;C# 3.0 - Automatic Properties&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;1114&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;378&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="146"&gt;&lt;font size="2"&gt;7&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="347"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/04/6265.aspx"&gt;&lt;font size="2"&gt;C# 3.0 - Extension Methods&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;915&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;385&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="146"&gt;&lt;font size="2"&gt;8&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="346"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/03/23/6235.aspx"&gt;&lt;font size="2"&gt;Building ActiveX with .NET&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;886&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;491&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="145"&gt;&lt;font size="2"&gt;9&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="346"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/27/6327.aspx"&gt;&lt;font size="2"&gt;Community Server 2007 - Captcha Control&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;788&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;555&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="145"&gt;&lt;font size="2"&gt;10&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="345"&gt;&lt;a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/03/6262.aspx"&gt;&lt;font size="2"&gt;C# 3.0 - Implicitly typed local variables&lt;/font&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="89"&gt;&lt;font size="2"&gt;688&lt;/font&gt;&lt;/td&gt;
&lt;td valign="top" width="87"&gt;&lt;font size="2"&gt;379&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Let's see what comes out in 2008.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/11227.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>I initiated this blog one year ago with the intention to write basically about .NET. I started very enthusiastic and having clear that I didn't want to write just about which products come out or what other blogger said before. But reviewing the posts of this past year I've figured out that I've not been as prolific as I would like and that some of my posts really suck. I mean, I already knew it but when you see the numbers is when you face the truth (I only reached an average of 3 posts per month). I guess that sometimes one does not have time enough and/or just does not find the right inspiration, in any case below you can see my top 10 list of posts based on the web visits received. Obviously the "post competition" is not fair, since the oldest the post is the more possibilities has to be visited, but doesn't really matter.</p>
<p>By the way, I don't understand why the number one received this amazing amount of web visits, who knows what people expected to find when searching how to hook a keyboard and mouse ;)</p>
<table cellspacing="0" cellpadding="2" width="687" border="2">
<tbody>
<tr>
<td valign="top" width="148"><strong><font size="2">Position</font></strong></td>
<td valign="top" width="359"><strong><font size="2">Post</font></strong></td>
<td valign="top" width="89"><strong><font size="2">Web Visits</font></strong></td>
<td valign="top" width="87"><strong><font size="2">Agg Visits</font></strong></td></tr>
<tr>
<td valign="top" width="148"><font size="2">1</font></td>
<td valign="top" width="356"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/06/20/6494.aspx"><font size="2">Hook Keyboard and Mouse</font></a></td>
<td valign="top" width="89"><font size="2">8263</font></td>
<td valign="top" width="87"><font size="2">341</font></td></tr>
<tr>
<td valign="top" width="148"><font size="2">2</font></td>
<td valign="top" width="354"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/09/6275.aspx"><font size="2">C# 3.0 - Object and Collection Initializers</font></a></td>
<td valign="top" width="89"><font size="2">1954</font></td>
<td valign="top" width="87"><font size="2">208</font></td></tr>
<tr>
<td valign="top" width="146"><font size="2">3</font></td>
<td valign="top" width="352"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/16/6298.aspx"><font size="2">Artificial Intelligence, bot and Live Messenger Add-In</font></a></td>
<td valign="top" width="89"><font size="2">1737</font></td>
<td valign="top" width="87"><font size="2">444</font></td></tr>
<tr>
<td valign="top" width="146"><font size="2">4</font></td>
<td valign="top" width="350"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/12/6287.aspx"><font size="2">C# 3.0 - Lambda Expressions</font></a></td>
<td valign="top" width="89"><font size="2">1700</font></td>
<td valign="top" width="87"><font size="2">395</font></td></tr>
<tr>
<td valign="top" width="145"><font size="2">5</font></td>
<td valign="top" width="349"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/07/08/6579.aspx"><font size="2">Google Safe Browsing API with Internet Explorer</font></a></td>
<td valign="top" width="89"><font size="2">1164</font></td>
<td valign="top" width="87"><font size="2">330</font></td></tr>
<tr>
<td valign="top" width="147"><font size="2">6</font></td>
<td valign="top" width="348"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/08/6271.aspx"><font size="2">C# 3.0 - Automatic Properties</font></a></td>
<td valign="top" width="89"><font size="2">1114</font></td>
<td valign="top" width="87"><font size="2">378</font></td></tr>
<tr>
<td valign="top" width="146"><font size="2">7</font></td>
<td valign="top" width="347"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/04/6265.aspx"><font size="2">C# 3.0 - Extension Methods</font></a></td>
<td valign="top" width="89"><font size="2">915</font></td>
<td valign="top" width="87"><font size="2">385</font></td></tr>
<tr>
<td valign="top" width="146"><font size="2">8</font></td>
<td valign="top" width="346"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/03/23/6235.aspx"><font size="2">Building ActiveX with .NET</font></a></td>
<td valign="top" width="89"><font size="2">886</font></td>
<td valign="top" width="87"><font size="2">491</font></td></tr>
<tr>
<td valign="top" width="145"><font size="2">9</font></td>
<td valign="top" width="346"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/27/6327.aspx"><font size="2">Community Server 2007 - Captcha Control</font></a></td>
<td valign="top" width="89"><font size="2">788</font></td>
<td valign="top" width="87"><font size="2">555</font></td></tr>
<tr>
<td valign="top" width="145"><font size="2">10</font></td>
<td valign="top" width="345"><a href="http://blogs.clearscreen.com/jfbonnin/archive/2007/04/03/6262.aspx"><font size="2">C# 3.0 - Implicitly typed local variables</font></a></td>
<td valign="top" width="89"><font size="2">688</font></td>
<td valign="top" width="87"><font size="2">379</font></td></tr></tbody></table>
<p>Let's see what comes out in 2008.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/11227.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Here Comes Another Bubble!</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/12/06/10425.aspx</link><pubDate>Thu, 06 Dec 2007 19:24:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/12/06/10425.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/10425.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/12/06/10425.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/10425.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/10425.aspx</trackback:ping><description>&lt;p&gt;Today I was reading a few articles about the Web 2.0 and I don't know how, I've found this funny song and after listen it I could not avoid blogging about it&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/fi4fzvQ6I-o&amp;amp;rel=1&amp;amp;border=0" width="425" height="355" type="application/x-shockwave-flash" wmode="transparent"&gt;&lt;/embed&gt;&lt;/p&gt; &lt;p&gt;Sometimes it's impressing the amount of time I can waste in Internet while I try to do other things I don't like ...&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/10425.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Today I was reading a few articles about the Web 2.0 and I don't know how, I've found this funny song and after listen it I could not avoid blogging about it<br /><embed src="http://www.youtube.com/v/fi4fzvQ6I-o&amp;rel=1&amp;border=0" width="425" height="355" type="application/x-shockwave-flash" wmode="transparent"></embed></p> <p>Sometimes it's impressing the amount of time I can waste in Internet while I try to do other things I don't like ...</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/10425.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Ineta Spain</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/10/15/8719.aspx</link><pubDate>Mon, 15 Oct 2007 20:11:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/10/15/8719.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/8719.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/10/15/8719.aspx#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/8719.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/8719.aspx</trackback:ping><description>&lt;p&gt;This weekend I received a very nice notice, I've been nominated to be the new Ineta Country Leader for Spain.&lt;/p&gt;
&lt;p&gt;My predecessor Miguel Jiménez did a hard job and I hope to be able to continue doing good things for the Spanish Ineta community.&lt;/p&gt;
&lt;p&gt;I know this will be a difficult task, the .NET groups in Spain have a lot of activity and ideas, but I will do my best to give them the support they deserve.&lt;/p&gt;
&lt;p&gt;I'm desiring to get my hands on the work.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/8719.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>This weekend I received a very nice notice, I've been nominated to be the new Ineta Country Leader for Spain.</p>
<p>My predecessor Miguel Jiménez did a hard job and I hope to be able to continue doing good things for the Spanish Ineta community.</p>
<p>I know this will be a difficult task, the .NET groups in Spain have a lot of activity and ideas, but I will do my best to give them the support they deserve.</p>
<p>I'm desiring to get my hands on the work.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/8719.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Delphi adventures or how to consume a .NET web service</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/08/15/7589.aspx</link><pubDate>Wed, 15 Aug 2007 02:18:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/08/15/7589.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/7589.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/08/15/7589.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/7589.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/7589.aspx</trackback:ping><description>&lt;p&gt;This past week one of our future customers have been trying to integrate with our web services without success; all the support process has been a bit complicated for several factors: first of all was they were the first customer integrating with us who did it using Delphi and our support department couldn't benefit of previous knowledge. Another one was that they don't have employees who can read nor speak other language than French, so we should make use of the Google Translator English - French - English and lot of imagination, but this was not a problem, I always say that when two parts want to communicate the communication is always possible.&lt;/p&gt; &lt;p&gt;The thing is that one week is a lot of time to finish the integration (we had customers integrating in a couple of hours), so we wanted to provide to our customer a solution in order he can start working with us a soon as possible. Today we decided to try to write some sample code for him, even if our developers are all .NET developers.&lt;/p&gt; &lt;p&gt;When I knew that they were using Delphi I felt a bit melancholic, I started working as a Delphi developer in the '98 building some CGI with version 3.0 ... I've tried to resist but I couldn't avoid it ... yes, I know ... don't say anything ... I wanted to see what is the current look of Delphi and try to write the code myself.&lt;/p&gt; &lt;p&gt;Following the suggestions of our customer I've visited the page &lt;a href="http://www.codegear.com/" target="_blank"&gt;CodeGear&lt;/a&gt; looking for the Turbo Delphi 6.0. The installation already pissed me off, has anybody seen the list of prerequisites? I can understand some things like the Microsoft .NET Framework, IE6 (this is also questionable ...), MSXML, but why should I install the Microsoft .NET SDK (Software Development Kit) v1.1? and Visual J#? there must be a confusion ...  I mean, I want to develop with Delphi not with .NET ... maybe my subconscious has betrayed me and I downloaded Turbo Delphi for .NET ... but it was not the case, so again I ask myself: Visual J#? Well doesn't matter, there must be a good reason for it and anyway I have Visual J# installed.&lt;/p&gt; &lt;p&gt;The first impression after open the IDE is that is quite similar to Visual Studio, the distribution of the windows are almost the same, I have the equivalent to IntelliSense, refactor...all seems very straighforward and I don't need to read too much code to get an idea of the syntaxis. It's time to consume webservices.&lt;/p&gt; &lt;p&gt;After look through almost all the menus and options I find the WSDL importer and after run it I get a kind of proxy with all the necessary classes imported. I get surprised because some types are not used directly but wrapped in structures, like decimal or datetime, everything works fine for simple services but there is one a bit more complex that doesn't want to work. At this point I need to look in the documentation and my first dissapointment appears, I cannot find anything that gives me a clue about what can be the cause. I add a trace module in the webservice to see what I receive from Delphi and there are some weird things like a value 1.0 converted to 56XXXXX.25 (I don't remeber the exact amount). &lt;/p&gt; &lt;p&gt;After lot of different tests I take a break with SOAP and I try another approach: use a simple POST request. I look for a class similar to the HttpWebRequest and after some "googling" (I couldn't find anything on the documenation and I really miss the MSDN), I see that exists a component that I can drag and drop on a form, but this component doesn't appear on the Toolbox. For a while I thought the component is a third party library not included with my version of Delphi, but then I see it's part of Indy, which I remember a radio button asking for version 9 or 10 when I was installing. So I know I have the class, I only need to find in which namespace it is to declare the variable. With .NET I don't have problems for this, I know where are lot of classes and I find quite intuitive the organization in namespaces, where can be this? Net, Networking, Web ... where is the "Resolve" feature? ... The unit I needed to add is the IdHTTP, I found it in the IndyProject, where I can see all the documentation regarding the classes used for HTTP requests, there are no search option or samples, but I have lot of patience. &lt;/p&gt; &lt;p&gt;The class I used has a "Request" property where I can set all the headers for the http request, it makes sense until I get my first exception: something like "Host empty"... how is that possible if I've just set the "Host" property? I rewrite the code in another way, at the end I don't need to set most of the headers, since they are already defaulted. The problem comes when I try to connect through HTTPS instead of HTTP, it seems I need to set a different IOHandler. This is extremely cool since in the hipothetical case I want to build my own handler to manage the SSL connections I can do it without build a different class to perform an HTTP post (I pretended to be ironic). I find in the IndyProject a SSL Handler which I think I read is an implementation of an open source library, the first try doesn't work and throws a very intuitive Read time out exception, I say intuitive because was nothing related to it...I'm not going to extend this post much more because the amount of complains grows exponentially, the important is that at the end it was working.&lt;/p&gt; &lt;p&gt;At the end I saw Delphi 6.0, I know this is not the last version, but really I don't want to see it again for a long time, I took me one day to figure out how to consume web services via HTTPS using soap and post requests. I recognize that after all this time working with .NET my brain is totally focused to what I know, but even if I criticize MSDN because doesn't have as much samples as it could have and some of them doesn't work, being honest the documentation I found about Delphi is very very poor comparing to what you can find in the MSDN about C# and I don't want to talk about lot of other important things about .NET. &lt;/p&gt; &lt;p&gt;Really, the only thing for which I would recommend to work with Delphi now is to migrate it to C#. Of course this is just a personal opinion and I'm sorry if I offended anybody, but for me there is no comparison possible. &lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/7589.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>This past week one of our future customers have been trying to integrate with our web services without success; all the support process has been a bit complicated for several factors: first of all was they were the first customer integrating with us who did it using Delphi and our support department couldn't benefit of previous knowledge. Another one was that they don't have employees who can read nor speak other language than French, so we should make use of the Google Translator English - French - English and lot of imagination, but this was not a problem, I always say that when two parts want to communicate the communication is always possible.</p> <p>The thing is that one week is a lot of time to finish the integration (we had customers integrating in a couple of hours), so we wanted to provide to our customer a solution in order he can start working with us a soon as possible. Today we decided to try to write some sample code for him, even if our developers are all .NET developers.</p> <p>When I knew that they were using Delphi I felt a bit melancholic, I started working as a Delphi developer in the '98 building some CGI with version 3.0 ... I've tried to resist but I couldn't avoid it ... yes, I know ... don't say anything ... I wanted to see what is the current look of Delphi and try to write the code myself.</p> <p>Following the suggestions of our customer I've visited the page <a href="http://www.codegear.com/" target="_blank">CodeGear</a> looking for the Turbo Delphi 6.0. The installation already pissed me off, has anybody seen the list of prerequisites? I can understand some things like the Microsoft .NET Framework, IE6 (this is also questionable ...), MSXML, but why should I install the Microsoft .NET SDK (Software Development Kit) v1.1? and Visual J#? there must be a confusion ...  I mean, I want to develop with Delphi not with .NET ... maybe my subconscious has betrayed me and I downloaded Turbo Delphi for .NET ... but it was not the case, so again I ask myself: Visual J#? Well doesn't matter, there must be a good reason for it and anyway I have Visual J# installed.</p> <p>The first impression after open the IDE is that is quite similar to Visual Studio, the distribution of the windows are almost the same, I have the equivalent to IntelliSense, refactor...all seems very straighforward and I don't need to read too much code to get an idea of the syntaxis. It's time to consume webservices.</p> <p>After look through almost all the menus and options I find the WSDL importer and after run it I get a kind of proxy with all the necessary classes imported. I get surprised because some types are not used directly but wrapped in structures, like decimal or datetime, everything works fine for simple services but there is one a bit more complex that doesn't want to work. At this point I need to look in the documentation and my first dissapointment appears, I cannot find anything that gives me a clue about what can be the cause. I add a trace module in the webservice to see what I receive from Delphi and there are some weird things like a value 1.0 converted to 56XXXXX.25 (I don't remeber the exact amount). </p> <p>After lot of different tests I take a break with SOAP and I try another approach: use a simple POST request. I look for a class similar to the HttpWebRequest and after some "googling" (I couldn't find anything on the documenation and I really miss the MSDN), I see that exists a component that I can drag and drop on a form, but this component doesn't appear on the Toolbox. For a while I thought the component is a third party library not included with my version of Delphi, but then I see it's part of Indy, which I remember a radio button asking for version 9 or 10 when I was installing. So I know I have the class, I only need to find in which namespace it is to declare the variable. With .NET I don't have problems for this, I know where are lot of classes and I find quite intuitive the organization in namespaces, where can be this? Net, Networking, Web ... where is the "Resolve" feature? ... The unit I needed to add is the IdHTTP, I found it in the IndyProject, where I can see all the documentation regarding the classes used for HTTP requests, there are no search option or samples, but I have lot of patience. </p> <p>The class I used has a "Request" property where I can set all the headers for the http request, it makes sense until I get my first exception: something like "Host empty"... how is that possible if I've just set the "Host" property? I rewrite the code in another way, at the end I don't need to set most of the headers, since they are already defaulted. The problem comes when I try to connect through HTTPS instead of HTTP, it seems I need to set a different IOHandler. This is extremely cool since in the hipothetical case I want to build my own handler to manage the SSL connections I can do it without build a different class to perform an HTTP post (I pretended to be ironic). I find in the IndyProject a SSL Handler which I think I read is an implementation of an open source library, the first try doesn't work and throws a very intuitive Read time out exception, I say intuitive because was nothing related to it...I'm not going to extend this post much more because the amount of complains grows exponentially, the important is that at the end it was working.</p> <p>At the end I saw Delphi 6.0, I know this is not the last version, but really I don't want to see it again for a long time, I took me one day to figure out how to consume web services via HTTPS using soap and post requests. I recognize that after all this time working with .NET my brain is totally focused to what I know, but even if I criticize MSDN because doesn't have as much samples as it could have and some of them doesn't work, being honest the documentation I found about Delphi is very very poor comparing to what you can find in the MSDN about C# and I don't want to talk about lot of other important things about .NET. </p> <p>Really, the only thing for which I would recommend to work with Delphi now is to migrate it to C#. Of course this is just a personal opinion and I'm sorry if I offended anybody, but for me there is no comparison possible. </p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/7589.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Google Safe Browsing API with Internet Explorer</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/08/6579.aspx</link><pubDate>Sun, 08 Jul 2007 16:57:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/08/6579.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/6579.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/08/6579.aspx#Feedback</comments><slash:comments>25</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/6579.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/6579.aspx</trackback:ping><description>&lt;p&gt;These days lot of bloggers have been writing about the new API of Google: &lt;a href="http://code.google.com/apis/safebrowsing/" target="_blank"&gt;Google Safe Browsing API.&lt;/a&gt; &lt;em&gt;The Safe Browsing API is an experimental API that enables client applications to check URLs against Google's constantly updated blacklists of suspected phishing and malware pages.&lt;/em&gt;&lt;/p&gt; &lt;p&gt;I think this is a cool API and if you want to take profit of it you already have it with &lt;a href="http://www.firefox.com" target="_blank"&gt;FireFox&lt;/a&gt;. But, I like Internet Explorer so I woud like to use both together. &lt;/p&gt; &lt;p&gt;If you take a look to the documentation, you will see that its usage is actually very easy. The idea is that you get a list of URL hashes, which are marked as phishing or malware; then you only need to validate the url's you want to check against these hash tables. I'm not going to enter in too much details since you can read the guide that Google provides you.&lt;/p&gt; &lt;p&gt;What I've done is let's say: a  "proof of concept", that it's possible to use Google Safe Browsing with IE. I've built an implementation of this using C#.  The code you can &lt;a href="http://blogs.clearscreen.com/jfbonnin/files/GoogleSafeBrowsing.zip"&gt;download&lt;/a&gt; consists in two main parts: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;A Windows Service that hosts a &lt;a href="http://wcf.netfx3.com/" target="_blank"&gt;WCF Service&lt;/a&gt; with the logic to perform updates and the validation against the hash tables.  &lt;/li&gt;&lt;li&gt;An &lt;a href="http://msdn2.microsoft.com/en-us/library/bb250436.aspx" target="_blank"&gt;BHO (Browser Helper Object)&lt;/a&gt; that queries the information to the WCF Service.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;The BHO is configured as an add-on for IE. It just handles the BeforeNavigate2 event and checks the URL making a call to the published service, if the URL is safe then nothing happens otherwise the navigation is cancelled and the message displayed:&lt;/p&gt; &lt;p&gt; &lt;/p&gt;&lt;img src="http://blogs.clearscreen.com/jfbonnin/files/MalwareScreenshot.png" border="0" /&gt;  &lt;p&gt; &lt;/p&gt; &lt;p&gt;The code for the BHO is pretty simple, the first you need to do is to declare the interface &lt;a href="http://msdn2.microsoft.com/en-us/library/aa768220.aspx" target="_blank"&gt;IObjectWithSite&lt;/a&gt; to make available for .NET&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080"&gt;1&lt;/span&gt; &lt;span style="color: #000000"&gt;[ComImport]
&lt;/span&gt;&lt;span style="color: #008080"&gt;2&lt;/span&gt; &lt;span style="color: #000000"&gt;[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
&lt;/span&gt;&lt;span style="color: #008080"&gt;3&lt;/span&gt; &lt;span style="color: #000000"&gt;[Guid(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;FC4801A3-2BA9-11CF-A229-00AA003D7352&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
&lt;/span&gt;&lt;span style="color: #008080"&gt;4&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;interface&lt;/span&gt;&lt;span style="color: #000000"&gt; IObjectWithSite
&lt;/span&gt;&lt;span style="color: #008080"&gt;5&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt;6&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; SetSite([In, MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite);
&lt;/span&gt;&lt;span style="color: #008080"&gt;7&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; GetSite(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; Guid riid, [MarshalAs(UnmanagedType.IUnknown)] &lt;/span&gt;&lt;span style="color: #0000ff"&gt;out&lt;/span&gt;&lt;span style="color: #000000"&gt; Object ppvSite);
&lt;/span&gt;&lt;span style="color: #008080"&gt;8&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; Once you have done this you need to do a class that implements it, this class will be the one loaded by IE and where you will capture the events.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080"&gt; 1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000"&gt; BalearesOnNet.GoogleSafeBrowsing.BHO
&lt;/span&gt;&lt;span style="color: #008080"&gt; 2&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt; 3&lt;/span&gt; &lt;span style="color: #000000"&gt;    [ComVisible(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;&lt;span style="color: #000000"&gt;),
&lt;/span&gt;&lt;span style="color: #008080"&gt; 4&lt;/span&gt; &lt;span style="color: #000000"&gt;    ClassInterface(ClassInterfaceType.None), Guid(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;D5423C28-959D-4909-BB9B-431286B62483&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
&lt;/span&gt;&lt;span style="color: #008080"&gt; 5&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; SafeBrowsingBHO : IObjectWithSite
&lt;/span&gt;&lt;span style="color: #008080"&gt; 6&lt;/span&gt; &lt;span style="color: #000000"&gt;    {
&lt;/span&gt;&lt;span style="color: #008080"&gt; 7&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;const&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; bhoRegistryKey &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;@"&lt;/span&gt;&lt;span style="color: #800000"&gt;SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 8&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 9&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt; SHDocVw.WebBrowser webBrowser;
&lt;/span&gt;&lt;span style="color: #008080"&gt;10&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;11&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;#region&lt;/span&gt;&lt;span style="color: #000000"&gt; IObjectWithSite Members&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;12&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;13&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; SetSite(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; pUnkSite)
&lt;/span&gt;&lt;span style="color: #008080"&gt;14&lt;/span&gt; &lt;span style="color: #000000"&gt;        {
&lt;/span&gt;&lt;span style="color: #008080"&gt;15&lt;/span&gt; &lt;span style="color: #000000"&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (pUnkSite &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;)
&lt;/span&gt;&lt;span style="color: #008080"&gt;16&lt;/span&gt; &lt;span style="color: #000000"&gt;            {
&lt;/span&gt;&lt;span style="color: #008080"&gt;17&lt;/span&gt; &lt;span style="color: #000000"&gt;                webBrowser.BeforeNavigate2 &lt;/span&gt;&lt;span style="color: #000000"&gt;-=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; DWebBrowserEvents2_BeforeNavigate2EventHandler(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.webBrowser_BeforeNavigate2);
&lt;/span&gt;&lt;span style="color: #008080"&gt;18&lt;/span&gt; &lt;span style="color: #000000"&gt;                webBrowser &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008080"&gt;19&lt;/span&gt; &lt;span style="color: #000000"&gt;            }
&lt;/span&gt;&lt;span style="color: #008080"&gt;20&lt;/span&gt; &lt;span style="color: #000000"&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;21&lt;/span&gt; &lt;span style="color: #000000"&gt;            {
&lt;/span&gt;&lt;span style="color: #008080"&gt;22&lt;/span&gt; &lt;span style="color: #000000"&gt;                webBrowser &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; (SHDocVw.WebBrowser)pUnkSite;
&lt;/span&gt;&lt;span style="color: #008080"&gt;23&lt;/span&gt; &lt;span style="color: #000000"&gt;                webBrowser.BeforeNavigate2 &lt;/span&gt;&lt;span style="color: #000000"&gt;+=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; DWebBrowserEvents2_BeforeNavigate2EventHandler(webBrowser_BeforeNavigate2);
&lt;/span&gt;&lt;span style="color: #008080"&gt;24&lt;/span&gt; &lt;span style="color: #000000"&gt;            }
&lt;/span&gt;&lt;span style="color: #008080"&gt;25&lt;/span&gt; &lt;span style="color: #000000"&gt;        }
&lt;/span&gt;&lt;span style="color: #008080"&gt;26&lt;/span&gt; &lt;span style="color: #000000"&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; The other interesting part of it, is how to cancel the navigation and modify the HtmlDocument, with our custom html.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080"&gt; 1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; webBrowser_BeforeNavigate2(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; pDisp, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; URL, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; Flags, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; TargetFrameName, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; PostData, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt; Headers, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;ref&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="color: #000000"&gt; Cancel)
&lt;/span&gt;&lt;span style="color: #008080"&gt; 2&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt; 3&lt;/span&gt; &lt;span style="color: #000000"&gt;    ....
&lt;/span&gt;&lt;span style="color: #008080"&gt; 4&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 5&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (result &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; UrlValidationResult.Malware &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; result &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; UrlValidationResult.BlackList)
&lt;/span&gt;&lt;span style="color: #008080"&gt; 6&lt;/span&gt; &lt;span style="color: #000000"&gt;    {
&lt;/span&gt;&lt;span style="color: #008080"&gt; 7&lt;/span&gt; &lt;span style="color: #000000"&gt;        IHTMLDocument2 doc &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; webBrowser.Document &lt;/span&gt;&lt;span style="color: #0000ff"&gt;as&lt;/span&gt;&lt;span style="color: #000000"&gt; IHTMLDocument2;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 8&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 9&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (doc &lt;/span&gt;&lt;span style="color: #000000"&gt;!=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;)
&lt;/span&gt;&lt;span style="color: #008080"&gt;10&lt;/span&gt; &lt;span style="color: #000000"&gt;        {
&lt;/span&gt;&lt;span style="color: #008080"&gt;11&lt;/span&gt; &lt;span style="color: #000000"&gt;            doc.clear();
&lt;/span&gt;&lt;span style="color: #008080"&gt;12&lt;/span&gt; &lt;span style="color: #000000"&gt;            doc.writeln(result &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; UrlValidationResult.Malware &lt;/span&gt;&lt;span style="color: #000000"&gt;?&lt;/span&gt;&lt;span style="color: #000000"&gt; Resources.MalwareWarning : Resources.BlackWarning);
&lt;/span&gt;&lt;span style="color: #008080"&gt;13&lt;/span&gt; &lt;span style="color: #000000"&gt;            doc.close();
&lt;/span&gt;&lt;span style="color: #008080"&gt;14&lt;/span&gt; &lt;span style="color: #000000"&gt;        }
&lt;/span&gt;&lt;span style="color: #008080"&gt;15&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;16&lt;/span&gt; &lt;span style="color: #000000"&gt;        Cancel &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008080"&gt;17&lt;/span&gt; &lt;span style="color: #000000"&gt;    }
&lt;/span&gt;&lt;span style="color: #008080"&gt;18&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The WCF Service exposes only two methods: "public void Update()" and "public UrlValidationResult ValidateUrl(Uri uri)". This service what it does is to obtain and keep updated the hash tables doing incremental updates, as well as the logic to validate the url's against these tables. The tables are stored in an &lt;a href="http://msdn2.microsoft.com/en-us/library/system.io.isolatedstorage.aspx" target="_blank"&gt;IsolatedStorage&lt;/a&gt; to avoid obtaining them from internet every time, nevertheless the tables are loaded and operated in memory.&lt;/p&gt;
&lt;p&gt;In order to validate a url you need to perform some steps, first of all you need to obtain a 128 bit MD5 Hash of the URL you want to check, then you need to get the string representation of this hash. With .NET you can accomplish this easily.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080"&gt; 1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; GetHash(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; url)
&lt;/span&gt;&lt;span style="color: #008080"&gt; 2&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt; 3&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;byte&lt;/span&gt;&lt;span style="color: #000000"&gt;[] hashBytes;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 4&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; (MD5 md5 &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; MD5.Create())
&lt;/span&gt;&lt;span style="color: #008080"&gt; 5&lt;/span&gt; &lt;span style="color: #000000"&gt;    {
&lt;/span&gt;&lt;span style="color: #008080"&gt; 6&lt;/span&gt; &lt;span style="color: #000000"&gt;        hashBytes &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; md5.ComputeHash(System.Text.Encoding.ASCII.GetBytes(url));
&lt;/span&gt;&lt;span style="color: #008080"&gt; 7&lt;/span&gt; &lt;span style="color: #000000"&gt;    }
&lt;/span&gt;&lt;span style="color: #008080"&gt; 8&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 9&lt;/span&gt; &lt;span style="color: #000000"&gt;    StringBuilder sb &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; StringBuilder(&lt;/span&gt;&lt;span style="color: #800080"&gt;32&lt;/span&gt;&lt;span style="color: #000000"&gt;);
&lt;/span&gt;&lt;span style="color: #008080"&gt;10&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;11&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&lt;span style="color: #000000"&gt; length &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; hashBytes.Length;
&lt;/span&gt;&lt;span style="color: #008080"&gt;12&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&lt;span style="color: #000000"&gt; i &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;; i &lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000"&gt; length; i&lt;/span&gt;&lt;span style="color: #000000"&gt;++&lt;/span&gt;&lt;span style="color: #000000"&gt;)
&lt;/span&gt;&lt;span style="color: #008080"&gt;13&lt;/span&gt; &lt;span style="color: #000000"&gt;    {
&lt;/span&gt;&lt;span style="color: #008080"&gt;14&lt;/span&gt; &lt;span style="color: #000000"&gt;        sb.Append(hashBytes[i].ToString(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;x2&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;));
&lt;/span&gt;&lt;span style="color: #008080"&gt;15&lt;/span&gt; &lt;span style="color: #000000"&gt;    }
&lt;/span&gt;&lt;span style="color: #008080"&gt;16&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;17&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; sb.ToString();
&lt;/span&gt;&lt;span style="color: #008080"&gt;18&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; Google suggest you also to perform several lookups from the same URL to get an accurated result, which consists of: the exact hostname in the URL, up to 4 hostnames formed by starting with the last 4 components and successively removing the leading component. In addition for the path you should try at most 6 different strings: the exact path of the url, including query parameters; the exact path of the url, without query parameters and the 4 paths formed by starting at the root (/) and succesively appending path components, including a trailing slahsh. A sample displays better what this means.&lt;/p&gt;
&lt;p&gt;For the url http://a.b.c.d.e.f.g/1.html&lt;/p&gt;
&lt;p&gt;a.b.c.d.e.f.g/1.html 
&lt;/p&gt;&lt;p&gt;a.b.c.d.e.f.g/ 
&lt;/p&gt;&lt;p&gt;c.d.e.f.g/1.html 
&lt;/p&gt;&lt;p&gt;c.d.e.f.g/ 
&lt;/p&gt;&lt;p&gt;d.e.f.g/1.html 
&lt;/p&gt;&lt;p&gt;d.e.f.g/ 
&lt;/p&gt;&lt;p&gt;e.f.g/1.html 
&lt;/p&gt;&lt;p&gt;e.f.g/ 
&lt;/p&gt;&lt;p&gt;f.g/1.html 
&lt;/p&gt;&lt;p&gt;f.g/ 
&lt;/p&gt;&lt;p&gt;*(Note that b.c.d.e.f.g, is skipped since we'll take only the last 5 hostname components, and the full hostname) 
&lt;/p&gt;&lt;p&gt;Another interesting feature is that you can verify that the tables obtained in the requests come from Google, this is obtained by requesting a pair of keys, client key and wrapped key. The wrapped key must be sent along the requests for updates, then Google will include a MAC (Message Authentication Code) in the header of each response following the structure "[mac=dRalfTU+bXwUhlk0NCGJtQ==]". In order to validate this mac you need to do again a 128 bit MD5 Hash with the following information: client_key|separator|table data|separator|client_key. Where the separator is the string:coolgoog: - that is a colon followed by "coolgoog" followed by a colon. To be honest I got a bit stuck here, I've tried a few ways to verify a MAC but there is something I'm missing and I cannot get the expected result. Maybe I try again when I come back from holidays.
&lt;/p&gt;&lt;p&gt;You can &lt;a href="http://blogs.clearscreen.com/jfbonnin/files/GoogleSafeBrowsing.zip"&gt;download&lt;/a&gt; the code and test it, but remember that this code is provided as is and cannot be considered finished code. There is room enough for improvement in many areas including exception handling that has not been considered for this sample.
&lt;/p&gt;&lt;p&gt;In order to test you will need to install and start the windows service included, before start it be sure that you include your own key in the appSettings section of the file "BalearesOnNet.GoogleSafeBrowsing.Service.exe.config". The BHO is configured to be installed when you compile it with Visual Studio, you can disable this option by unchecking the option "Register for COM interop" in the properties of the project.
&lt;/p&gt;&lt;p&gt;I hope you like it.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/6579.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>These days lot of bloggers have been writing about the new API of Google: <a href="http://code.google.com/apis/safebrowsing/" target="_blank">Google Safe Browsing API.</a> <em>The Safe Browsing API is an experimental API that enables client applications to check URLs against Google's constantly updated blacklists of suspected phishing and malware pages.</em></p> <p>I think this is a cool API and if you want to take profit of it you already have it with <a href="http://www.firefox.com" target="_blank">FireFox</a>. But, I like Internet Explorer so I woud like to use both together. </p> <p>If you take a look to the documentation, you will see that its usage is actually very easy. The idea is that you get a list of URL hashes, which are marked as phishing or malware; then you only need to validate the url's you want to check against these hash tables. I'm not going to enter in too much details since you can read the guide that Google provides you.</p> <p>What I've done is let's say: a  "proof of concept", that it's possible to use Google Safe Browsing with IE. I've built an implementation of this using C#.  The code you can <a href="http://blogs.clearscreen.com/jfbonnin/files/GoogleSafeBrowsing.zip">download</a> consists in two main parts: </p> <ul> <li>A Windows Service that hosts a <a href="http://wcf.netfx3.com/" target="_blank">WCF Service</a> with the logic to perform updates and the validation against the hash tables.  </li><li>An <a href="http://msdn2.microsoft.com/en-us/library/bb250436.aspx" target="_blank">BHO (Browser Helper Object)</a> that queries the information to the WCF Service.</li></ul> <p> </p> <p>The BHO is configured as an add-on for IE. It just handles the BeforeNavigate2 event and checks the URL making a call to the published service, if the URL is safe then nothing happens otherwise the navigation is cancelled and the message displayed:</p> <p> </p><img src="http://blogs.clearscreen.com/jfbonnin/files/MalwareScreenshot.png" border="0" />  <p> </p> <p>The code for the BHO is pretty simple, the first you need to do is to declare the interface <a href="http://msdn2.microsoft.com/en-us/library/aa768220.aspx" target="_blank">IObjectWithSite</a> to make available for .NET</p> <div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080">1</span> <span style="color: #000000">[ComImport]
</span><span style="color: #008080">2</span> <span style="color: #000000">[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
</span><span style="color: #008080">3</span> <span style="color: #000000">[Guid(</span><span style="color: #800000">"</span><span style="color: #800000">FC4801A3-2BA9-11CF-A229-00AA003D7352</span><span style="color: #800000">"</span><span style="color: #000000">)]
</span><span style="color: #008080">4</span> <span style="color: #000000"></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">interface</span><span style="color: #000000"> IObjectWithSite
</span><span style="color: #008080">5</span> <span style="color: #000000">{
</span><span style="color: #008080">6</span> <span style="color: #000000">    </span><span style="color: #0000ff">void</span><span style="color: #000000"> SetSite([In, MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite);
</span><span style="color: #008080">7</span> <span style="color: #000000">    </span><span style="color: #0000ff">void</span><span style="color: #000000"> GetSite(</span><span style="color: #0000ff">ref</span><span style="color: #000000"> Guid riid, [MarshalAs(UnmanagedType.IUnknown)] </span><span style="color: #0000ff">out</span><span style="color: #000000"> Object ppvSite);
</span><span style="color: #008080">8</span> <span style="color: #000000">}</span></div></pre></div>
<p> Once you have done this you need to do a class that implements it, this class will be the one loaded by IE and where you will capture the events.</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080"> 1</span> <span style="color: #0000ff">namespace</span><span style="color: #000000"> BalearesOnNet.GoogleSafeBrowsing.BHO
</span><span style="color: #008080"> 2</span> <span style="color: #000000">{
</span><span style="color: #008080"> 3</span> <span style="color: #000000">    [ComVisible(</span><span style="color: #0000ff">true</span><span style="color: #000000">),
</span><span style="color: #008080"> 4</span> <span style="color: #000000">    ClassInterface(ClassInterfaceType.None), Guid(</span><span style="color: #800000">"</span><span style="color: #800000">D5423C28-959D-4909-BB9B-431286B62483</span><span style="color: #800000">"</span><span style="color: #000000">)]
</span><span style="color: #008080"> 5</span> <span style="color: #000000">    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> SafeBrowsingBHO : IObjectWithSite
</span><span style="color: #008080"> 6</span> <span style="color: #000000">    {
</span><span style="color: #008080"> 7</span> <span style="color: #000000">        </span><span style="color: #0000ff">private</span><span style="color: #000000"> </span><span style="color: #0000ff">const</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> bhoRegistryKey </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800000">@"</span><span style="color: #800000">SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects</span><span style="color: #800000">"</span><span style="color: #000000">;
</span><span style="color: #008080"> 8</span> <span style="color: #000000">
</span><span style="color: #008080"> 9</span> <span style="color: #000000">        </span><span style="color: #0000ff">private</span><span style="color: #000000"> SHDocVw.WebBrowser webBrowser;
</span><span style="color: #008080">10</span> <span style="color: #000000">
</span><span style="color: #008080">11</span> <span style="color: #000000">        </span><span style="color: #0000ff">#region</span><span style="color: #000000"> IObjectWithSite Members</span><span style="color: #000000">
</span><span style="color: #008080">12</span> <span style="color: #000000">
</span><span style="color: #008080">13</span> <span style="color: #000000">        </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> SetSite(</span><span style="color: #0000ff">object</span><span style="color: #000000"> pUnkSite)
</span><span style="color: #008080">14</span> <span style="color: #000000">        {
</span><span style="color: #008080">15</span> <span style="color: #000000">            </span><span style="color: #0000ff">if</span><span style="color: #000000"> (pUnkSite </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">)
</span><span style="color: #008080">16</span> <span style="color: #000000">            {
</span><span style="color: #008080">17</span> <span style="color: #000000">                webBrowser.BeforeNavigate2 </span><span style="color: #000000">-=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> DWebBrowserEvents2_BeforeNavigate2EventHandler(</span><span style="color: #0000ff">this</span><span style="color: #000000">.webBrowser_BeforeNavigate2);
</span><span style="color: #008080">18</span> <span style="color: #000000">                webBrowser </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">;
</span><span style="color: #008080">19</span> <span style="color: #000000">            }
</span><span style="color: #008080">20</span> <span style="color: #000000">            </span><span style="color: #0000ff">else</span><span style="color: #000000">
</span><span style="color: #008080">21</span> <span style="color: #000000">            {
</span><span style="color: #008080">22</span> <span style="color: #000000">                webBrowser </span><span style="color: #000000">=</span><span style="color: #000000"> (SHDocVw.WebBrowser)pUnkSite;
</span><span style="color: #008080">23</span> <span style="color: #000000">                webBrowser.BeforeNavigate2 </span><span style="color: #000000">+=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> DWebBrowserEvents2_BeforeNavigate2EventHandler(webBrowser_BeforeNavigate2);
</span><span style="color: #008080">24</span> <span style="color: #000000">            }
</span><span style="color: #008080">25</span> <span style="color: #000000">        }
</span><span style="color: #008080">26</span> <span style="color: #000000">...</span></div></pre></div>
<p> The other interesting part of it, is how to cancel the navigation and modify the HtmlDocument, with our custom html.</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080"> 1</span> <span style="color: #0000ff">void</span><span style="color: #000000"> webBrowser_BeforeNavigate2(</span><span style="color: #0000ff">object</span><span style="color: #000000"> pDisp, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">object</span><span style="color: #000000"> URL, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">object</span><span style="color: #000000"> Flags, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">object</span><span style="color: #000000"> TargetFrameName, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">object</span><span style="color: #000000"> PostData, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">object</span><span style="color: #000000"> Headers, </span><span style="color: #0000ff">ref</span><span style="color: #000000"> </span><span style="color: #0000ff">bool</span><span style="color: #000000"> Cancel)
</span><span style="color: #008080"> 2</span> <span style="color: #000000">{
</span><span style="color: #008080"> 3</span> <span style="color: #000000">    ....
</span><span style="color: #008080"> 4</span> <span style="color: #000000">
</span><span style="color: #008080"> 5</span> <span style="color: #000000">    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (result </span><span style="color: #000000">==</span><span style="color: #000000"> UrlValidationResult.Malware </span><span style="color: #000000">||</span><span style="color: #000000"> result </span><span style="color: #000000">==</span><span style="color: #000000"> UrlValidationResult.BlackList)
</span><span style="color: #008080"> 6</span> <span style="color: #000000">    {
</span><span style="color: #008080"> 7</span> <span style="color: #000000">        IHTMLDocument2 doc </span><span style="color: #000000">=</span><span style="color: #000000"> webBrowser.Document </span><span style="color: #0000ff">as</span><span style="color: #000000"> IHTMLDocument2;
</span><span style="color: #008080"> 8</span> <span style="color: #000000">
</span><span style="color: #008080"> 9</span> <span style="color: #000000">        </span><span style="color: #0000ff">if</span><span style="color: #000000"> (doc </span><span style="color: #000000">!=</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">)
</span><span style="color: #008080">10</span> <span style="color: #000000">        {
</span><span style="color: #008080">11</span> <span style="color: #000000">            doc.clear();
</span><span style="color: #008080">12</span> <span style="color: #000000">            doc.writeln(result </span><span style="color: #000000">==</span><span style="color: #000000"> UrlValidationResult.Malware </span><span style="color: #000000">?</span><span style="color: #000000"> Resources.MalwareWarning : Resources.BlackWarning);
</span><span style="color: #008080">13</span> <span style="color: #000000">            doc.close();
</span><span style="color: #008080">14</span> <span style="color: #000000">        }
</span><span style="color: #008080">15</span> <span style="color: #000000">
</span><span style="color: #008080">16</span> <span style="color: #000000">        Cancel </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">true</span><span style="color: #000000">;
</span><span style="color: #008080">17</span> <span style="color: #000000">    }
</span><span style="color: #008080">18</span> <span style="color: #000000">}</span></div></pre></div>
<p>The WCF Service exposes only two methods: "public void Update()" and "public UrlValidationResult ValidateUrl(Uri uri)". This service what it does is to obtain and keep updated the hash tables doing incremental updates, as well as the logic to validate the url's against these tables. The tables are stored in an <a href="http://msdn2.microsoft.com/en-us/library/system.io.isolatedstorage.aspx" target="_blank">IsolatedStorage</a> to avoid obtaining them from internet every time, nevertheless the tables are loaded and operated in memory.</p>
<p>In order to validate a url you need to perform some steps, first of all you need to obtain a 128 bit MD5 Hash of the URL you want to check, then you need to get the string representation of this hash. With .NET you can accomplish this easily.</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="color: #008080"> 1</span> <span style="color: #0000ff">private</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> GetHash(</span><span style="color: #0000ff">string</span><span style="color: #000000"> url)
</span><span style="color: #008080"> 2</span> <span style="color: #000000">{
</span><span style="color: #008080"> 3</span> <span style="color: #000000">    </span><span style="color: #0000ff">byte</span><span style="color: #000000">[] hashBytes;
</span><span style="color: #008080"> 4</span> <span style="color: #000000">    </span><span style="color: #0000ff">using</span><span style="color: #000000"> (MD5 md5 </span><span style="color: #000000">=</span><span style="color: #000000"> MD5.Create())
</span><span style="color: #008080"> 5</span> <span style="color: #000000">    {
</span><span style="color: #008080"> 6</span> <span style="color: #000000">        hashBytes </span><span style="color: #000000">=</span><span style="color: #000000"> md5.ComputeHash(System.Text.Encoding.ASCII.GetBytes(url));
</span><span style="color: #008080"> 7</span> <span style="color: #000000">    }
</span><span style="color: #008080"> 8</span> <span style="color: #000000">
</span><span style="color: #008080"> 9</span> <span style="color: #000000">    StringBuilder sb </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> StringBuilder(</span><span style="color: #800080">32</span><span style="color: #000000">);
</span><span style="color: #008080">10</span> <span style="color: #000000">
</span><span style="color: #008080">11</span> <span style="color: #000000">    </span><span style="color: #0000ff">int</span><span style="color: #000000"> length </span><span style="color: #000000">=</span><span style="color: #000000"> hashBytes.Length;
</span><span style="color: #008080">12</span> <span style="color: #000000">    </span><span style="color: #0000ff">for</span><span style="color: #000000"> (</span><span style="color: #0000ff">int</span><span style="color: #000000"> i </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #800080">0</span><span style="color: #000000">; i </span><span style="color: #000000">&lt;</span><span style="color: #000000"> length; i</span><span style="color: #000000">++</span><span style="color: #000000">)
</span><span style="color: #008080">13</span> <span style="color: #000000">    {
</span><span style="color: #008080">14</span> <span style="color: #000000">        sb.Append(hashBytes[i].ToString(</span><span style="color: #800000">"</span><span style="color: #800000">x2</span><span style="color: #800000">"</span><span style="color: #000000">));
</span><span style="color: #008080">15</span> <span style="color: #000000">    }
</span><span style="color: #008080">16</span> <span style="color: #000000">
</span><span style="color: #008080">17</span> <span style="color: #000000">    </span><span style="color: #0000ff">return</span><span style="color: #000000"> sb.ToString();
</span><span style="color: #008080">18</span> <span style="color: #000000">}</span></div></pre></div>
<p> Google suggest you also to perform several lookups from the same URL to get an accurated result, which consists of: the exact hostname in the URL, up to 4 hostnames formed by starting with the last 4 components and successively removing the leading component. In addition for the path you should try at most 6 different strings: the exact path of the url, including query parameters; the exact path of the url, without query parameters and the 4 paths formed by starting at the root (/) and succesively appending path components, including a trailing slahsh. A sample displays better what this means.</p>
<p>For the url http://a.b.c.d.e.f.g/1.html</p>
<p>a.b.c.d.e.f.g/1.html 
</p><p>a.b.c.d.e.f.g/ 
</p><p>c.d.e.f.g/1.html 
</p><p>c.d.e.f.g/ 
</p><p>d.e.f.g/1.html 
</p><p>d.e.f.g/ 
</p><p>e.f.g/1.html 
</p><p>e.f.g/ 
</p><p>f.g/1.html 
</p><p>f.g/ 
</p><p>*(Note that b.c.d.e.f.g, is skipped since we'll take only the last 5 hostname components, and the full hostname) 
</p><p>Another interesting feature is that you can verify that the tables obtained in the requests come from Google, this is obtained by requesting a pair of keys, client key and wrapped key. The wrapped key must be sent along the requests for updates, then Google will include a MAC (Message Authentication Code) in the header of each response following the structure "[mac=dRalfTU+bXwUhlk0NCGJtQ==]". In order to validate this mac you need to do again a 128 bit MD5 Hash with the following information: client_key|separator|table data|separator|client_key. Where the separator is the string:coolgoog: - that is a colon followed by "coolgoog" followed by a colon. To be honest I got a bit stuck here, I've tried a few ways to verify a MAC but there is something I'm missing and I cannot get the expected result. Maybe I try again when I come back from holidays.
</p><p>You can <a href="http://blogs.clearscreen.com/jfbonnin/files/GoogleSafeBrowsing.zip">download</a> the code and test it, but remember that this code is provided as is and cannot be considered finished code. There is room enough for improvement in many areas including exception handling that has not been considered for this sample.
</p><p>In order to test you will need to install and start the windows service included, before start it be sure that you include your own key in the appSettings section of the file "BalearesOnNet.GoogleSafeBrowsing.Service.exe.config". The BHO is configured to be installed when you compile it with Visual Studio, you can disable this option by unchecking the option "Register for COM interop" in the properties of the project.
</p><p>I hope you like it.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/6579.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>The curse of copy paste</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/01/6522.aspx</link><pubDate>Sun, 01 Jul 2007 22:05:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/01/6522.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/6522.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/07/01/6522.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/6522.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/6522.aspx</trackback:ping><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Today I want to write about the most powerful development tool of our days: the copy paste. &lt;/p&gt;&lt;p&gt;Copy paste helps you to develop faster, increases a lot your productivity, you can develop business components, forms, entire applications; you can develop code even before you understand what it does … all just in minutes!! Your boss is happy, your customer even more and that’s great … but what happens when the original code has a bug? Then all the copy pasted components, forms, applications we did in minutes’ trend to have the same bug and now you need to fix it everywhere, the amount of bugs grows at lightspeed. But, hey!! doesn’t matter, why don’t we use copy paste again to patch everywhere? … Sorry, you are done, once you have started with this development style, there is no return back, you are damned by the “the curse of the copy paste”. Hereinafter you are damned to find the same comments, bugs, even wrongly typed method and variable names … everywhere &lt;/p&gt;&lt;p&gt;Don’t you believe me? Do a review or try to download tools like Simian and use them inside one of the projects of your clients, of course you will not find anything in your own projects, won’t you? Better don’t try. &lt;/p&gt;&lt;p&gt;Maybe it can make you feel better knowing that software like … mmm I’m not going to say the name because I want to be politically correct (tip: it’s a widely used tool to rapidly build web sites with forums, blogs and photos). If you already know which software I’m talking about, try to search “blog” in the project supposed to contain code for photos: 30 matching lines. This deserves a bigger “wow” than the 3D Vista windows; “at least” most of them are comments. &lt;/p&gt;&lt;p&gt;Next time after copy and before paste, please just stop for a second and try to think if you can refactor your classes … lot of times copy paste development is synonym of a bad design.  &lt;/p&gt;&lt;p&gt;Of course we can also sum our efforts and ask Microsoft to remove the copy paste functionality from all versions of Visual Studio.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/6522.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p></p> <p>Today I want to write about the most powerful development tool of our days: the copy paste. </p><p>Copy paste helps you to develop faster, increases a lot your productivity, you can develop business components, forms, entire applications; you can develop code even before you understand what it does … all just in minutes!! Your boss is happy, your customer even more and that’s great … but what happens when the original code has a bug? Then all the copy pasted components, forms, applications we did in minutes’ trend to have the same bug and now you need to fix it everywhere, the amount of bugs grows at lightspeed. But, hey!! doesn’t matter, why don’t we use copy paste again to patch everywhere? … Sorry, you are done, once you have started with this development style, there is no return back, you are damned by the “the curse of the copy paste”. Hereinafter you are damned to find the same comments, bugs, even wrongly typed method and variable names … everywhere </p><p>Don’t you believe me? Do a review or try to download tools like Simian and use them inside one of the projects of your clients, of course you will not find anything in your own projects, won’t you? Better don’t try. </p><p>Maybe it can make you feel better knowing that software like … mmm I’m not going to say the name because I want to be politically correct (tip: it’s a widely used tool to rapidly build web sites with forums, blogs and photos). If you already know which software I’m talking about, try to search “blog” in the project supposed to contain code for photos: 30 matching lines. This deserves a bigger “wow” than the 3D Vista windows; “at least” most of them are comments. </p><p>Next time after copy and before paste, please just stop for a second and try to think if you can refactor your classes … lot of times copy paste development is synonym of a bad design.  </p><p>Of course we can also sum our efforts and ask Microsoft to remove the copy paste functionality from all versions of Visual Studio.</p><img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/6522.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jose Fco. Bonnin</dc:creator><title>Community Server 2007 - Captcha Control</title><link>http://blogs.clearscreen.com/jfbonnin/archive/2007/04/27/6327.aspx</link><pubDate>Fri, 27 Apr 2007 19:48:00 GMT</pubDate><guid>http://blogs.clearscreen.com/jfbonnin/archive/2007/04/27/6327.aspx</guid><wfw:comment>http://blogs.clearscreen.com/jfbonnin/comments/6327.aspx</wfw:comment><comments>http://blogs.clearscreen.com/jfbonnin/archive/2007/04/27/6327.aspx#Feedback</comments><slash:comments>17</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/jfbonnin/comments/commentRss/6327.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/jfbonnin/services/trackbacks/6327.aspx</trackback:ping><description>&lt;p&gt;One of the problems we had in the past at &lt;a href="http://www.baleareson.net/" target="_blank"&gt;Baleares on .NET&lt;/a&gt; was the amount of user registrations done by bots, to avoid it we managed to install a &lt;a href="http://dbvt.com/files/folders/addons/entry5198.aspx"&gt;captcha&lt;/a&gt; control deployed by &lt;a href="http://dbvt.com/" target="_blank"&gt;Dave Burke&lt;/a&gt; on the Join option of Community Server. This captha was created for Community Server 2.1, so after install the new version 2007 we needed to do some changes.&lt;/p&gt;
&lt;p&gt;Fortunately having the source code of CS is very easy to understand how to apply the changes to have the control up and running again. &lt;/p&gt;
&lt;p&gt;Maybe it's possible to create a standalone captcha control and plug it to CS, but since in the past we already needed to modify the CreateUser class, I've preferred just to add it as part of it and recompile. Let's see how I did it.&lt;/p&gt;
&lt;p&gt;I've added to the Components folder of CommunityServerComponents20 project a slightly modified version of the CaptchaService class (now called Captcha), nothing important, just added IDisposable interface, some extra disposing not done and modified to use "using" (I'm a fan of the using statement) for some objects instead of the method Dispose at the end of the method. &lt;/p&gt;
&lt;p&gt;Then in the folder Page of the project CommunityServerControls20 I've added the source code for JpegImage.cs, again with minor modifications.&lt;/p&gt;
&lt;p&gt;After this is when we really need to modify the necessary code to support the Captcha component in our Registration page. The idea we follow is to add a new textbox in order our users can introduce the code displayed in the image of the captcha control. To do it we need to modify the class CreateUserForm that is contained in the folder Forms. &lt;/p&gt;
&lt;p&gt;We start adding a new field of type TextBox called "CaptchaCodeTextBox" and the next property.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="color: #008080"&gt;1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt; CaptchaCodeTextBoxId
&lt;/span&gt;&lt;span style="color: #008080"&gt;2&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt;3&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;get&lt;/span&gt;&lt;span style="color: #000000"&gt; { &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;)ViewState[&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;CaptchaCodeTextBoxId&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;] &lt;/span&gt;&lt;span style="color: #000000"&gt;??&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.Empty; }
&lt;/span&gt;&lt;span style="color: #008080"&gt;4&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;set&lt;/span&gt;&lt;span style="color: #000000"&gt; { ViewState[&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;CaptchaCodeTextBoxId&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;] &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; value; }
&lt;/span&gt;&lt;span style="color: #008080"&gt;5&lt;/span&gt; &lt;span style="color: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will allow us retrieving the name of the textbox we will add later on in the ASP.NET page for validation. In the method "AttachChildControls" we get and check that effectively the ASP.NET page contains the required textbox. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="color: #008080"&gt;1&lt;/span&gt; &lt;span style="color: #000000"&gt;CaptchaCodeTextBox &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; CSControlUtility.Instance().FindControl(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;, CaptchaCodeTextBoxId) &lt;/span&gt;&lt;span style="color: #0000ff"&gt;as&lt;/span&gt;&lt;span style="color: #000000"&gt; TextBox;
&lt;/span&gt;&lt;span style="color: #008080"&gt;2&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;3&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (UserNameTextBox &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;4&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; PasswordTextBox &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;5&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; EmailAddressTextBox &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;6&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; CreateButton &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;7&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; CreateUserCustomValidator &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;8&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #000000"&gt;||&lt;/span&gt;&lt;span style="color: #000000"&gt; CaptchaCodeTextBox &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;null&lt;/span&gt;&lt;span style="color: #000000"&gt;)
&lt;/span&gt;&lt;span style="color: #008080"&gt;9&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;throw&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; InvalidOperationException(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;UserNameTextBoxId, PasswordTextBoxId, EmailAddressTextBoxId, CreateUserCustomValidatorId, CaptchaCodeTextBoxId and CreateButtonId must be valid controls to render a CreateUserForm&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;At the end of the same method we also create the cookie that will contain the code to be manually introduced by the user.&lt;/p&gt;
&lt;p&gt;HttpContext.Current.Response.Cookies[Captcha.CookieName].Value = Captcha.GenerateRandomCode();&lt;/p&gt;
&lt;p&gt;The next method to modify is the one called "IsValid". As you already supposed, here is where we will compare the code introduced by the user with the one we have randomly generated. The code is very simple, take a look:&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="color: #008080"&gt;1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.CaptchaCodeTextBox.Text &lt;/span&gt;&lt;span style="color: #000000"&gt;!=&lt;/span&gt;&lt;span style="color: #000000"&gt; HttpContext.Current.Request.Cookies[Captcha.CookieName].Value)
&lt;/span&gt;&lt;span style="color: #008080"&gt;2&lt;/span&gt; &lt;span style="color: #000000"&gt;{
&lt;/span&gt;&lt;span style="color: #008080"&gt;3&lt;/span&gt; &lt;span style="color: #000000"&gt;    CreateUserCustomValidator.ErrorMessage &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; CommunityServer.Components.ResourceManager.GetString(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;CreateNewAccount_InvalidCaptchaCode&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;);
&lt;/span&gt;&lt;span style="color: #008080"&gt;4&lt;/span&gt; &lt;span style="color: #000000"&gt;    CreateUserCustomValidator.IsValid &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008080"&gt;5&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008080"&gt;6&lt;/span&gt; &lt;span style="color: #000000"&gt;}
&lt;/span&gt;&lt;span style="color: #008080"&gt;7&lt;/span&gt; &lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;8&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;&lt;span style="color: #000000"&gt;.CaptchaCodeTextBox.Text &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;.Empty;
&lt;/span&gt;&lt;span style="color: #008080"&gt;9&lt;/span&gt; &lt;span style="color: #000000"&gt;HttpContext.Current.Response.Cookies[Captcha.CookieName].Value &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; Captcha.GenerateRandomCode();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note that in the line 3 we are using a new Resource name that we will need to introduce in the Resources.xml file. &lt;/p&gt;
&lt;p&gt;With this we are already done with the source code, now we need to do the last updates to the CreateUser.aspx page.&lt;/p&gt;
&lt;p&gt;Open the page and at the beginning of the CSControl:CreateUserForm you will see a list with the id's used for the required controls, as I said before we need to add the one for the new textbox.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="color: #008080"&gt; 1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;CSControl:CreateUserForm &lt;/span&gt;&lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 2&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    AcceptAgreementCheckBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="AcceptAgreement"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 3&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    AcceptAgreementHyperLinkId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="AcceptAgreementLink"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 4&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    AllowSitePartnersToContactCheckBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="AllowSitePartnersToContact"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 5&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    AllowSiteToContactCheckBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="AllowSiteToContact"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 6&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    CreateButtonId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CreateAccount"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 7&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    CreateUserCustomValidatorId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CreateUserCustomValidator"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 8&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    EmailAddressTextBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Email"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt; 9&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    PasswordTextBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Password"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt;10&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    SubFormIds&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=""&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt;11&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    TimeZoneDropDownListId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Timezone"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; 
&lt;/span&gt;&lt;span style="color: #008080"&gt;12&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    UserNameTextBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Username"&lt;/span&gt;&lt;span style="color: #ff0000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;13&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    CaptchaCodeTextBoxId&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CaptchaCode"&lt;/span&gt;&lt;span style="color: #ff0000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;14&lt;/span&gt; &lt;span style="color: #ff0000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt; Then you only need add the next code somewhere in the page. I did it after the "TimeZone" DropDownList. Note again that we have added a new resource (line 3).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color: white; word-wrap: break-word"&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="color: #008080"&gt; 1&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 2&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;td &lt;/span&gt;&lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CommonFormFieldName"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 3&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;CSControl:ResourceControl &lt;/span&gt;&lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; ResourceName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CreateNewAccount_EnterCode"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 4&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 5&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 6&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;div &lt;/span&gt;&lt;span style="color: #ff0000"&gt;class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CommonFormField"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 7&lt;/span&gt; &lt;span style="color: #000000"&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CaptchaCode"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; MaxLength&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="128"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; columns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="40"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; onkeyup &lt;/span&gt;&lt;span style="color: #0000ff"&gt;="validateForm(this);"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 8&lt;/span&gt; &lt;span style="color: #000000"&gt;            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;asp:RequiredFieldValidator &lt;/span&gt;&lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="captchaValidator"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; ControlToValidate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="CaptchaCode"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; Cssclass&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="validationWarning"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;*&lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt; 9&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;10&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;11&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;12&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;13&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;td &lt;/span&gt;&lt;span style="color: #ff0000"&gt;align&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="right"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;span style="color: #800000"&amp;gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;14&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;15&lt;/span&gt; &lt;span style="color: #000000"&gt;        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span style="color: #800000"&gt;img &lt;/span&gt;&lt;span style="color: #ff0000"&gt;src&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="../JpegImage.aspx"&lt;/span&gt;&lt;span style="color: #ff0000"&gt; alt&lt;/span&gt;&lt;span style="color: #0000ff"&gt;="Captcha Image"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;16&lt;/span&gt; &lt;span style="color: #000000"&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;td&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008080"&gt;17&lt;/span&gt; &lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;span style="color: #800000"&amp;gt;tr&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To finish you only need to add to the page JpegImage.aspx in the root folder, replace the assemblies of the folder bin CommunityServer.Components.dll, CommunityServer.Controls.dll with the ones we modified above and don't forget to the two new Resources to the file Resources.xml contained in each language folder you support. Just something like this:&lt;/p&gt;
&lt;p&gt;&lt;resource name="CreateNewAccount_EnterCode"&gt;Enter the Code:&lt;/resource&gt; &lt;/p&gt;
&lt;p&gt;&lt;resource name="CreateNewAccount_InvalidCaptchaCode"&gt;Code does not match with the image displayed&lt;/resource&gt; &lt;/p&gt;
&lt;p&gt;That's all; we are ready to use our new captcha control!!&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/jfbonnin/aggbug/6327.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>One of the problems we had in the past at <a href="http://www.baleareson.net/" target="_blank">Baleares on .NET</a> was the amount of user registrations done by bots, to avoid it we managed to install a <a href="http://dbvt.com/files/folders/addons/entry5198.aspx">captcha</a> control deployed by <a href="http://dbvt.com/" target="_blank">Dave Burke</a> on the Join option of Community Server. This captha was created for Community Server 2.1, so after install the new version 2007 we needed to do some changes.</p>
<p>Fortunately having the source code of CS is very easy to understand how to apply the changes to have the control up and running again. </p>
<p>Maybe it's possible to create a standalone captcha control and plug it to CS, but since in the past we already needed to modify the CreateUser class, I've preferred just to add it as part of it and recompile. Let's see how I did it.</p>
<p>I've added to the Components folder of CommunityServerComponents20 project a slightly modified version of the CaptchaService class (now called Captcha), nothing important, just added IDisposable interface, some extra disposing not done and modified to use "using" (I'm a fan of the using statement) for some objects instead of the method Dispose at the end of the method. </p>
<p>Then in the folder Page of the project CommunityServerControls20 I've added the source code for JpegImage.cs, again with minor modifications.</p>
<p>After this is when we really need to modify the necessary code to support the Captcha component in our Registration page. The idea we follow is to add a new textbox in order our users can introduce the code displayed in the image of the captcha control. To do it we need to modify the class CreateUserForm that is contained in the folder Forms. </p>
<p>We start adding a new field of type TextBox called "CaptchaCodeTextBox" and the next property.</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: #008080">1</span> <span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000"> CaptchaCodeTextBoxId
</span><span style="color: #008080">2</span> <span style="color: #000000">{
</span><span style="color: #008080">3</span> <span style="color: #000000">    </span><span style="color: #0000ff">get</span><span style="color: #000000"> { </span><span style="color: #0000ff">return</span><span style="color: #000000"> (</span><span style="color: #0000ff">string</span><span style="color: #000000">)ViewState[</span><span style="color: #800000">"</span><span style="color: #800000">CaptchaCodeTextBoxId</span><span style="color: #800000">"</span><span style="color: #000000">] </span><span style="color: #000000">??</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000">.Empty; }
</span><span style="color: #008080">4</span> <span style="color: #000000">    </span><span style="color: #0000ff">set</span><span style="color: #000000"> { ViewState[</span><span style="color: #800000">"</span><span style="color: #800000">CaptchaCodeTextBoxId</span><span style="color: #800000">"</span><span style="color: #000000">] </span><span style="color: #000000">=</span><span style="color: #000000"> value; }
</span><span style="color: #008080">5</span> <span style="color: #000000">}</span></div></pre></div>
<p>This will allow us retrieving the name of the textbox we will add later on in the ASP.NET page for validation. In the method "AttachChildControls" we get and check that effectively the ASP.NET page contains the required textbox. </p>
<p></p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: #008080">1</span> <span style="color: #000000">CaptchaCodeTextBox </span><span style="color: #000000">=</span><span style="color: #000000"> CSControlUtility.Instance().FindControl(</span><span style="color: #0000ff">this</span><span style="color: #000000">, CaptchaCodeTextBoxId) </span><span style="color: #0000ff">as</span><span style="color: #000000"> TextBox;
</span><span style="color: #008080">2</span> <span style="color: #000000">
</span><span style="color: #008080">3</span> <span style="color: #000000"></span><span style="color: #0000ff">if</span><span style="color: #000000"> (UserNameTextBox </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">
</span><span style="color: #008080">4</span> <span style="color: #000000">    </span><span style="color: #000000">||</span><span style="color: #000000"> PasswordTextBox </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">
</span><span style="color: #008080">5</span> <span style="color: #000000">    </span><span style="color: #000000">||</span><span style="color: #000000"> EmailAddressTextBox </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">
</span><span style="color: #008080">6</span> <span style="color: #000000">    </span><span style="color: #000000">||</span><span style="color: #000000"> CreateButton </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">
</span><span style="color: #008080">7</span> <span style="color: #000000">    </span><span style="color: #000000">||</span><span style="color: #000000"> CreateUserCustomValidator </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">
</span><span style="color: #008080">8</span> <span style="color: #000000">    </span><span style="color: #000000">||</span><span style="color: #000000"> CaptchaCodeTextBox </span><span style="color: #000000">==</span><span style="color: #000000"> </span><span style="color: #0000ff">null</span><span style="color: #000000">)
</span><span style="color: #008080">9</span> <span style="color: #000000">    </span><span style="color: #0000ff">throw</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> InvalidOperationException(</span><span style="color: #800000">"</span><span style="color: #800000">UserNameTextBoxId, PasswordTextBoxId, EmailAddressTextBoxId, CreateUserCustomValidatorId, CaptchaCodeTextBoxId and CreateButtonId must be valid controls to render a CreateUserForm</span><span style="color: #800000">"</span><span style="color: #000000">);</span></div></pre></div>
<p></p>
<p>At the end of the same method we also create the cookie that will contain the code to be manually introduced by the user.</p>
<p>HttpContext.Current.Response.Cookies[Captcha.CookieName].Value = Captcha.GenerateRandomCode();</p>
<p>The next method to modify is the one called "IsValid". As you already supposed, here is where we will compare the code introduced by the user with the one we have randomly generated. The code is very simple, take a look:</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: #008080">1</span> <span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #0000ff">this</span><span style="color: #000000">.CaptchaCodeTextBox.Text </span><span style="color: #000000">!=</span><span style="color: #000000"> HttpContext.Current.Request.Cookies[Captcha.CookieName].Value)
</span><span style="color: #008080">2</span> <span style="color: #000000">{
</span><span style="color: #008080">3</span> <span style="color: #000000">    CreateUserCustomValidator.ErrorMessage </span><span style="color: #000000">=</span><span style="color: #000000"> CommunityServer.Components.ResourceManager.GetString(</span><span style="color: #800000">"</span><span style="color: #800000">CreateNewAccount_InvalidCaptchaCode</span><span style="color: #800000">"</span><span style="color: #000000">);
</span><span style="color: #008080">4</span> <span style="color: #000000">    CreateUserCustomValidator.IsValid </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;
</span><span style="color: #008080">5</span> <span style="color: #000000">    </span><span style="color: #0000ff">return</span><span style="color: #000000"> </span><span style="color: #0000ff">false</span><span style="color: #000000">;
</span><span style="color: #008080">6</span> <span style="color: #000000">}
</span><span style="color: #008080">7</span> <span style="color: #000000">
</span><span style="color: #008080">8</span> <span style="color: #000000"></span><span style="color: #0000ff">this</span><span style="color: #000000">.CaptchaCodeTextBox.Text </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">string</span><span style="color: #000000">.Empty;
</span><span style="color: #008080">9</span> <span style="color: #000000">HttpContext.Current.Response.Cookies[Captcha.CookieName].Value </span><span style="color: #000000">=</span><span style="color: #000000"> Captcha.GenerateRandomCode();</span></div></pre></div>
<p>Note that in the line 3 we are using a new Resource name that we will need to introduce in the Resources.xml file. </p>
<p>With this we are already done with the source code, now we need to do the last updates to the CreateUser.aspx page.</p>
<p>Open the page and at the beginning of the CSControl:CreateUserForm you will see a list with the id's used for the required controls, as I said before we need to add the one for the new textbox.</p>
<div class="wlWriterSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:635063e8-01fa-45b7-a760-e33b3667e6ed" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"><pre style="background-color: white; word-wrap: break-word"><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: #008080"> 1</span> <span style="color: #0000ff"><span style="color: #800000">CSControl:CreateUserForm </span><span style="color: #ff0000">runat</span><span style="color: #0000ff">="server"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 2</span> <span style="color: #ff0000">    AcceptAgreementCheckBoxId</span><span style="color: #0000ff">="AcceptAgreement"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 3</span> <span style="color: #ff0000">    AcceptAgreementHyperLinkId</span><span style="color: #0000ff">="AcceptAgreementLink"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 4</span> <span style="color: #ff0000">    AllowSitePartnersToContactCheckBoxId</span><span style="color: #0000ff">="AllowSitePartnersToContact"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 5</span> <span style="color: #ff0000">    AllowSiteToContactCheckBoxId</span><span style="color: #0000ff">="AllowSiteToContact"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 6</span> <span style="color: #ff0000">    CreateButtonId</span><span style="color: #0000ff">="CreateAccount"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 7</span> <span style="color: #ff0000">    CreateUserCustomValidatorId</span><span style="color: #0000ff">="CreateUserCustomValidator"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 8</span> <span style="color: #ff0000">    EmailAddressTextBoxId</span><span style="color: #0000ff">="Email"</span><span style="color: #ff0000"> 
</span><span style="color: #008080"> 9</span> <span style="color: #ff0000">    PasswordTextBoxId</span><span style="color: #0000ff">="Password"</span><span style="color: #ff0000"> 
</span><span style="color: #008080">10</span> <span style="color: #ff0000">    SubFormIds</span><span style="color: #0000ff">=""</span><span style="color: #ff0000"> 
</span><span style="color: #008080">11</span> <span style="color: #ff0000">    TimeZoneDropDownListId</span><span style="color: #0000ff">="Timezone"</span