3

我正在使用 asp.net/c# weborms。我在表格中添加了recaptcha,并使用了他们网站上的内容。它需要自定义外观,因此它是这样的:

<div id="recaptcha_widget" style="display:none">

   <div id="recaptcha_image"></div>
   <div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>

   <span class="recaptcha_only_if_image">Enter the words above:</span>
   <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span>

   <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />

   <div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div>
   <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div>
   <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div>

   <div><a href="javascript:Recaptcha.showhelp()">Help</a></div>

 </div>

 <script type="text/javascript"
    src="http://api.recaptcha.net/challenge?k=your_public_key">
 </script>
 <noscript>
   <iframe src="http://api.recaptcha.net/noscript?k=your_public_key"
        height="300" width="500" frameborder="0"></iframe><br>
   <textarea name="recaptcha_challenge_field" rows="3" cols="40">
   </textarea>
   <input type="hidden" name="recaptcha_response_field"
        value="manual_challenge">
 </noscript>

我需要在表单后面的代码中的 button_click 方法中做什么来检查用户输入的单词是否正确。音频也一样。

谢谢

4

2 回答 2

1

为什么不使用 reCaptcha 提供的控件?这是控件和快速入门。

reCaptcha 快速入门和控制

于 2010-04-28T06:28:36.953 回答
1

Like other validations you just need to check if(Page.IsValid) in behind code. just note that you have to add recaptcha control in your code and then add your customs them.

<recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="your_public_key"
PrivateKey="Your_private_key" Theme="custom" />
<div id="recaptcha_widget" style="display:none">
<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div>
...
于 2011-12-06T00:17:07.097 回答