Introduction : NoBot Control attempts to provide CAPTCHA like bots prevention. It's essentially invisible and works
by setting a number of parameters designed to protect against bots.
Step : 1 Open Visual Studio and select
File Menu option.
- Select ASP.NET WebSite.
- Go to Solution Explorer and right click.
- Select WebForm and click ok.
Step : 2 Drag and Drop Control in
Toolbox.
- Drag ScriptManager, NOBot Extender in Ajax
Control ToolKit.
- Write a code.
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
: 4 Now go to Design view and double click in Button.
Code :
Inherits
System.Web.UI.Page
Protected
Sub Page_Load(sender As
Object, e As
System.EventArgs)
Handles Me.Load
End Sub
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
End
Class
Step :5 Now Press F5 and run it.