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

<channel>
	<title>Dot Net Thoughts &#187; Captcha HTML Helper</title>
	<atom:link href="http://www.dotnetthoughts.net/tag/captcha-html-helper/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dotnetthoughts.net</link>
	<description>thoughts about .Net, WPF, Sharepoint, Javascript and more.</description>
	<lastBuildDate>Wed, 28 Jul 2010 09:59:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Creating Captcha HTML Helper</title>
		<link>http://www.dotnetthoughts.net/2009/09/15/creating-captcha-html-helper/</link>
		<comments>http://www.dotnetthoughts.net/2009/09/15/creating-captcha-html-helper/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 09:49:13 +0000</pubDate>
		<dc:creator>Anuraj P</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net 3.0 / 3.5]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C#.Net]]></category>
		<category><![CDATA[Captcha]]></category>
		<category><![CDATA[Captcha HTML Helper]]></category>
		<category><![CDATA[Custom HTML Helper]]></category>

		<guid isPermaLink="false">http://anuraj.wordpress.com/?p=389</guid>
		<description><![CDATA[After working with ASP.Net MVC, and my previous posts, in this Post I am trying to implement a Captcha HTML Helper, an HTML Helper is just a method that returns a string. Creating Custom HTML Helpers. It is an extension method, to the existing HTML Helper class. Here is code.(For more details about the Captcha [...]]]></description>
			<content:encoded><![CDATA[<p>After working with ASP.Net MVC, and my previous posts, in this Post I am trying to implement a Captcha HTML Helper, an HTML Helper is just a method that returns a string. <a href="http://www.asp.net/learn/mvc/tutorial-09-cs.aspx" target="_blank">Creating Custom HTML Helpers</a>. It is an extension method, to the existing HTML Helper class.<br />
Here is code.(For more details about the Captcha generation code, check my previous post. : <a href="http://anuraj.wordpress.com/2009/09/15/captcha-using-asp-net-and-c/">Captcha using ASP.Net and C#</a>);</p>
<pre class="brush: csharp;">
 public static class CaptchaHelper
    {
        public static string Captcha(this HtmlHelper helper, string text)
        {
            string srcPath = System.Web.VirtualPathUtility.ToAbsolute(&quot;~/Handler1.ashx&quot;);
            string htmlContent = string.Empty;
            htmlContent += &quot;&lt;script type=\&quot;text/javascript\&quot;&gt;function __rc(){document.getElementById(\&quot;&quot; + text +
                           &quot;\&quot;).src = \&quot;../Handler1.ashx?query=\&quot; + Math.random();}&lt;/script&gt;&quot;;
            htmlContent += string.Format(&quot;&lt;img id=\&quot;{0}\&quot; src=\&quot;{1}\&quot; alt=\&quot;Captcha Image\&quot;/&gt;&quot;, text, srcPath);
            htmlContent += &quot;&lt;a href=\&quot;#\&quot; onclick=\&quot;javascript:__rc();\&quot;&gt;Reset&lt;/a&gt;&quot;;
            return htmlContent;
        }
    }
</pre>
<p>And in the View you can use like, you may need to import the Namespace of CaptchaHelper class.</p>
<pre class="brush: xml;">
 &lt; %= Html.Captcha(&quot;Sample&quot;) %&gt;
</pre>
<p>It will render a security image. Happy Programming</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dotnetthoughts.net/2009/09/15/creating-captcha-html-helper/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
