Extender Ajax NoBot Control in VB.NET

This article demonstrate how to read and enter cryptic text same as CAPTCHA.
  • 3238

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.

Step : 2 Go to Solution Explorer and right click.

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

Code :

   <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
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 />

Step : 3 Go to Design option.

  • Double click in Button.
  • Write a code.

Code :

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()
  Label2.Text = state.ToString()
 End If
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)
        Label4.Text = sb.ToString()
    End Sub

Step : 4 Now press F5 and run .



More Articles

© 2020 DotNetHeaven. All rights reserved.