Over 4 months ago, I've enabled comments for blogs site-wide, and I wasn't aware at that time, but spam started coming in.
Yesterday, I started looking into how to stop spam from coming into my blog.
First, I brushed up some old code, and created a new assembly in Visual Studio 2022.
Then, I added the following code:
<%@ Import Namespace="chuacw.TelligentCommunity" %> <%@ Import Namespace="chuacw.WebControls" %> <%@ Register TagPrefix="cw" Namespace="chuacw.TelligentCommunity" Assembly="chuacw.TelligentCommunity" %> <%@ Register TagPrefix="cw" Namespace="chuacw.WebControls" Assembly="chuacw.TelligentCommunity" %>
into the file BlogPostCommentForm.ascx.
Then, I located the location where the Submit button is, and right before that, I added my captcha web control:
<li class="field-item"> <CSControl:ConditionalContent id="CaptchaContainer" runat="server"> <ContentConditions><CSControl:UserPropertyValueComparison runat="server" UseAccessingUser="true" ComparisonProperty="IsAnonymous" Operator="IsSetOrTrue" /></ContentConditions> <TrueContentTemplate> <dt>Enter the following code to ensure that your comment reaches the intended party:</dt> <dd><cw:Captcha runat="server" id="commentCaptcha" ValidationGroup="CreateCommentForm" /></dd> </TrueContentTemplate> <FalseContentTemplate> </FalseContentTemplate> </CSControl:ConditionalContent> </li>
I then updated the ValidationGroup and id as well.
Next, I added the captchaimage.aspx file to the Web directory.
And that has stopped the spam that's coming in.