【发布时间】:2016-08-13 21:39:39
【问题描述】:
我已将其包含在我的 .ascx 文件中
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" style="max-width:100%; width:300px;margin:0 auto;" data-sitekey="I_PUT_MY_SITEKEY_HERE"></div>
这是我的 .ascx.cs 文件中的内容
protected void SubmitButton_Click(object sender, EventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
try
{
//this is where all the email template code is, not important
}
catch (Exception ex)
{
Logger.Error("Contact Form", ex);
}
}
}
如您所见,我正在尝试在单击提交按钮时验证验证码,如果验证码有效,则通过联系表单发送电子邮件。我哪里错了?验证码显示正常,只需要它与表单一起使用即可。
【问题讨论】:
标签: asp.net validation captcha