Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi guys,
Can you confirm what i have done is sufficient to stop spam.
When the page loads:
@{
Layout = "Layout.cshtml";
int aNumber = new Random().Next(1, 3);
int bNumber = new Random().Next(1, 11);
var errorPrintOut = "";
bool contactSent = false;
}
The numbers are displayed to the user to add:
<label id="captchaCheckLabel" for="captchaCheck">@aNumber + @bNumber =</label><p style="color:red; font-size: 20px;">@errorPrintOut</p>
<input type="hidden" name="nA" value="@aNumber" />
<input type="hidden" name="nB" value="@bNumber" />
The user submits the form and:
@if (IsPost)
{
var capchaCheck = Request.Form["captchaCheck"].AsInt();
var nA = Request.Form["nA"].AsInt();
var nB = Request.Form["nB"].AsInt();
if (capchaCheck == (nA + nB))
//send email
contactSent = true;
else
errorPrintOut = "Sorry that was incorrect. Please try again.";
In esence will this stop spam bots or not?
Kind regards.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Some captcha for my form
Hi guys,
Can you confirm what i have done is sufficient to stop spam.
When the page loads:
@{
Layout = "Layout.cshtml";
int aNumber = new Random().Next(1, 3);
int bNumber = new Random().Next(1, 11);
var errorPrintOut = "";
bool contactSent = false;
}
The numbers are displayed to the user to add:
<label id="captchaCheckLabel" for="captchaCheck">@aNumber + @bNumber =</label><p style="color:red; font-size: 20px;">@errorPrintOut</p>
<input type="hidden" name="nA" value="@aNumber" />
<input type="hidden" name="nB" value="@bNumber" />
The user submits the form and:
@if (IsPost)
{
var capchaCheck = Request.Form["captchaCheck"].AsInt();
var nA = Request.Form["nA"].AsInt();
var nB = Request.Form["nB"].AsInt();
if (capchaCheck == (nA + nB))
{
//send email
contactSent = true;
}
else
{
errorPrintOut = "Sorry that was incorrect. Please try again.";
}
}
In esence will this stop spam bots or not?
Kind regards.
is working on a reply...