2010-04-27 42 views
3

將recaptcha(自定義外觀)與asp.net/c#weborms集成在一起。我已將recaptcha添加到表單中,並使用了他們網站上的內容。它需要一個自定義外觀,因此是這樣的:使用asp.net

<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方法做在後面的代碼IOF的形式,以檢查是否由用戶eneterd的話是正確的。音頻也一樣。

感謝

回答

1

像你只需要在後面的代碼檢查,如果(Page.IsValid)等驗證。只需注意,您必須在代碼中添加recaptcha控件,然後添加您的習俗。

<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> 
...