我想在我的ASP.NET code插入验证码。基本上,在 lbt_proceed_click()
的方法,我想浏览器中使用,以进入下一个页面的Response.Redirect(富)
只有当输入了验证码是否正确。
我搜查,但没有找到解决的办法,尤其是因为我没有使用表单发送数据,而是直接写入到数据库,然后使用移动到下一个页面的Response.Redirect( )
。
@Page指令后,插入以下code:
<%@注册标签preFIX =验证码命名空间=验证码集结号=验证码%>
在asp.net标记添加控件:
<验证码:RecaptchaControl
ID =验证码
=服务器
公钥=你自己的公钥这里
PrivateKey =你自己的隐私。这里的关键
/>
添加按钮和标签到表单中
在隐藏文件code添加下面的按钮点击的方法(btnSubmit_Click)
如果(Page.IsValid)
{
lblResult.Text =你猜对了! //或使用的Response.Redirect(富);
}
其他
{
lblResult.Text =不正确的;
}
测试您的主页!
I am trying to insert a captcha in my ASP.NET code. Basically, in the lbt_proceed_click()
method, I want the browser to proceed to the next page using Response.Redirect("foo")
only if the captcha entered is correct.
I searched, but could not find a solution, especially since I am not using a form to send data, but writing to a database directly, and then moving to the next page using Response.Redirect()
.
after the @Page directive, insert the following code:
<%@ Register TagPrefix="recaptcha" Namespace="Recaptcha" Assembly="Recaptcha"%>
add control in asp.net tag:
<recaptcha:RecaptchaControl
ID="recaptcha"
runat="server"
PublicKey="Your very own public key here"
PrivateKey="Your very own privat key here"
/>
add button and label to your form
add the following button click method(btnSubmit_Click) in code behind file :
if (Page.IsValid)
{
lblResult.Text = "You Got It!"; // Or Use Response.redirect("foo");
}
else
{
lblResult.Text = "Incorrect";
}
Test your Page!
上一篇:如何解决不支持单声道的异常调用CryptDeriveKey CspParameters不支持、如何解决、单声道、异常
下一篇:EqualityComparer&LT; T&GT; .DEFAULT不够聪明聪明、LT、EqualityComparer、DEFAULT