简体   繁体   English

在asp.net上使用Telerik rad captcha

[英]Using Telerik rad captcha with asp.net

I am new to telerik controls. 我是Telerik控件的新手。 I have a aspx form with HTML controls on it. 我有一个带HTML控件的aspx表单。 Data will be submitted using post method. 数据将采用邮寄方式提交。 I want to use Telerik Captcha on my page. 我想在页面上使用Telerik Captcha。

I have added following code on my aspx page : 我在aspx页面上添加了以下代码:

<form id="frmYourDetails" runat="server" method="post" action="save.aspx">
Number: <input type="text" name="CustomerNumber" id="CustomerNumber" pattern="\d{2}-(?:\d{4}-){3}\d{1}" maxlength="19" title="xx-xxxx-xxxx-xxxx-x" required >
Name :  <input type="text" name ="CustomerName" id ="CustomerName" required >

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadCaptcha ID="RadCaptcha1" Runat="server" ErrorMessage="The code you entered is not valid." Display="Dynamic"></telerik:RadCaptcha>

<button type="submit" id="btnSubmit">Save</button>
</form>

How do i validate if user has entered correct value in textbox that comes with RadCaptcha? 如何验证用户是否在RadCaptcha随附的文本框中输入了正确的值? I want this validation on client side if possible. 如果可能,我希望在客户端进行此验证。

Captchas do not validate on the client, only on the sever for security reasons (if they did on the client they would be next to useless). 验证码不会在客户端上进行验证,仅出于安全原因才在服务器上进行验证(如果在客户端上进行验证,则几乎是无用的)。

Call the Validate() method of the captcha or the page and check the IsValid property of the captcha. 调用Validate()码或页面的Validate()方法并检查Validate()码的IsValid属性。

You can see more options by using the RadCaptcha events in this demo http://demos.telerik.com/aspnet-ajax/captcha/examples/serversideevents/defaultcs.aspx 您可以在此演示中使用RadCaptcha事件查看更多选项http://demos.telerik.com/aspnet-ajax/captcha/examples/serversideevents/defaultcs.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM