Basic Captcha Example using the Ektron Server Controls

  • Updated

Ektron has built in captcha support right out of the box. Here is an example of how you could implement it on a template.

<%@ Page Language="C#" %>
<%@ Register Assembly="Ektron.Cms.Framework.UI.Controls" Namespace="Ektron.Cms.Framework.UI.Controls" TagPrefix="cms" %>
<%@ Register TagPrefix="cms" Namespace="Ektron.Cms.Controls" Assembly="Ektron.Cms.Controls" %>
<!DOCTYPE html>

<script runat="server">
  
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                captcha1.Visible = false;
            }
        }
   
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <%-- You will need to change the DefaultFormID --%>
    <ektron:FormControl id="FormBlock1" runat="server" DefaultFormID="414" AddValidation="True" DynamicParameter="ekfrm"></ektron:FormControl> 
     <cms:Captcha ID="captcha1" runat="server" Visible="true"/>
    </div>
    </form>
</body>
</html>