Capcha In ASP.NET??
What is capcha??
A CAPTCHA is a type of challenge-response test used in computing as an attempt to ensure that the response is not generated by a computer. The process usually involves one computer (a server)
asking a user to complete a simple test which the computer is able to
generate and grade. Because other computers are supposedly unable to
solve the CAPTCHA, any user entering a correct solution is presumed to
be human.
How to implement in ASP.NET?
Step 1: In the page add the following:
<%@ Register Assembly="WebControlCaptcha" Namespace="WebControlCaptcha" TagPrefix="Capcha" %>
<div style="width: 230px;" class="greenContainer">
<Capcha:CaptchaControl id="capcha" enableviewstate="false" enabletheming="false"
captchamaxtimeout="300" runat="server" layoutstyle="Vertical" cssclass="fL" />
captchamaxtimeout="300" runat="server" layoutstyle="Vertical" cssclass="fL" />
</div>
Step 2: Add the following css
.greenContainer
{border:1px solid #6a377d;background-color:#f7f2f9;overflow:auto;padding:10px;}
Step 3: In the Save button
The save operation should be done only within
if (Page.IsValid)
{}
Step 4: Add the following in the web.config file.
<system.web>
<httpHandlers>
<add verb="GET" path="CaptchaImage.aspx" type="WebControlCaptcha.CaptchaImageHandler, WebControlCaptcha"/>
</httpHandlers>
</system.web>
No comments:
Post a Comment