ARTICLE

NoBot Extender Control in Ajax

Posted by Davin Martyn Articles | ASP.NET AJAX in VB.NET September 28, 2011
This article demonstrate how to read and enter cryptic text same as CAPTCHA.
 
Reader Level:

Introduction : NoBot Extender Control attempt to provide the same functionality as CAPTCHA controls without requiring user to read and enter cryptic text.Its work by setting a number of parameter designed to protect against bots.

Step : 1 Open Visual Studio and select File menu option.

  • Select ASP.NET Web Site.
  • Default.aspx page open.
ASP-page1.gif

Step : 2 Go to Solution Explorer and right click.

  • Select Web Form.
  • Drag and Drop control in Toolbox.
  • Write a code.
webforms.gif

Code :

<
title></title>
</head>
<
body>
   <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager
>
<div>
     <
asp:Label ID="Label1" runat="server" Text="hello"></asp:Label>
    <asp:Label ID="Label2" runat="server" Font-Size = "Medium"></asp:Label>
    <br />
    <asp:Label ID="Label3" runat="server" Text="client information"></asp:Label>
    <asp:Label ID="Label4" runat="server" Font-Size = "Medium"></asp:Label>
    <asp:NoBot ID="NoBot1" runat="server" CutoffMaximumInstances = "5" CutoffWindowSeconds = "60" ResponseMinimumDelaySeconds = "2" />
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick = "Button1_Click" />
    <br />
    </div>
    </form
>
</body>
</
html>

Step : 3 Go to Design option.

  • Double click in Button.
  • Write a code.

Code :

Protected
Sub Button1_Click(sender As Object, e As EventArgs)
        Dim state As NoBotState
        ' if condition to check the response state of NoBot
        If NoBot1.IsValid(state) Then
            Label2.Text = state.ToString()
        Else
  Label2.Text = state.ToString()
 End If
Dim
sb As New StringBuilder()
        ' foreach loop to get cached IP address and datetime assocated with it(when last postback was occurred)
        For Each keyValue As System.Collections.Generic.KeyValuePair(Of DateTime, String) In NoBot.GetCopyOfUserAddressCache()
 sb.AppendFormat("{0}: {1}<br />", keyValue.Key.ToString(), keyValue.Value)
        Next
        Label4.Text = sb.ToString()
    End
Sub

Step : 4 Now press F5 and run .

spam1.gif

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor