2016-04-20 105 views
0

我在.ascx文件包括在此asp.net表單驗證驗證碼

<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); 
     } 
    } 

} 

正如你看到的我是試圖在提交按鈕點擊驗證驗證碼,然後如果驗證有效,則通過聯繫表單發送電子郵件。我哪裏錯了?驗證碼顯示正常,只需要它與表單一起工作即可。

回答