views:

449

answers:

3

Does anyone know how to tie a custom control (simple ASP.net Form) with sitefinity's Captcha control?

Can't seem to find the control (in the drag and drop sense) in amongst the SiteFinity.Web.UI

A: 

A quick Google search results in: http://www.sitefinity.com/help/developer-manual/built-in-spam-protector-strategies.html

Make sure you have added the correct references. According to the API Reference it seems you might need to add a reference to the Telerik.Web.UI library.

brianpeiris
A: 

How come you can't just drop the Captcha control onto the page through the Sitefinity page editor? That is what I would do

Sean Molam
+2  A: 

I've bee looking for exactly the same thing and after much searching I found this solution.

In the source view of your form/usercontrol add this reference:

<%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Web.UI.SpamProtection" TagPrefix="sfWeb" %>

Then you can use something like this:

<sfWeb:SpamProtector
    ID="SpamProtector1" 
    runat="server" 
    ValidationGroup="ctl00$PasswordRecovery1" 
    CaptchaImageWidth="180" 
    CaptchaImageHeight="50" 
    CapcthaInvalidInputMsg="The code you entered doesn't match the code in the image. Please try again." 
    EnableCaptcha="true" 
    CaptchaTextBoxLabel="Please type in the code shown in the image above." 
    CaptchaBackgroundNoise="Medium" 
    CaptchaLineNoise="Low"
    CaptchaFontWarp="Medium"
    CaptchaLength="5" 
    CaptchaPossibleChars="Numbers" 
    CaptchaMaxTimeout="5" 
    ErrorMessageCssClass="validation-error"></sfWeb:SpamProtector>

This solution was found buiried inside this article http://blogs.sitefinity.com/Ivan/Posts/08-10-29/How_to_associate_Image_Gallery_with_content_item_e_g_news_item_-_finishing_touches.aspx

The only issue is that the location of the generated captcha image refers to the location of your usercontrol i.e. localhost/MyWebsite/UserControls/Login/CaptchaImage.axd?guid=a2b92290-1bad-450a-a58b-7c813a228d62

sven