How to Prevent Automated Website Registrations?
register with a website to become a member of that site you would have
noted that you are asked to enter the text that is displayed in an image
to a form field. The image that displays the text is randomly generated
for each registration. This makes sure that the user who is registering
with the site is a genuine user. This prevents automated registrations
to the site.
a random string
After you generate the image with the random string you can use an image control to display the image. The image control can be embedded in the form that is used for registration so that the user can view the image that is generated and key-in the text that is displayed in the image. You can use a code similar to that given below to generate a random string.
In the above code you are generating a random number and that random number is converted to a character if the number is equal to or between 0 and 9, or between 65 and 86. You may note that the number 65 corresponds to letter A and you know what is the number for the character Z. The characters are concatenated to string variable until you get the length of the string that is desired. The code for generating a string can be within a function so that it can be used while generating the image.
To generate an image on the fly with the string that is generated you can use the Graphics class.
The above code is used to generate an image on the fly and is outputted to the response stream. This output is fed to the Image control that is used in the registration form. If you have the above code snippet in one webform, the URL of that webform is the URL of the Image Control in the registration form. This enables the generated image to be bound to the image control for display in the form. The image control would have code something similar that is given below:
<asp:Image id=Image1 runat="server" ImageUrl="url-of-the-page-that-generates-image" />
To compare the string in the generated image with the string that is typed by the user, the string that is generated is immediately stored in a session variable and then the image is generated. The string that is stored in the session variable is compared with the string that is keyed in by the user and error message is generated if needed. The above code for generating the image is placed within an if block which checks whether the user accesses the page for the first time. If the user is accessing the page for the first time then the image is generated, otherwise not. The code,
saves the image that is generated in the GIF format for display.
You can use the above algorithms and code snippets to develop web forms in .Net that enable you to prevent automatic registrations to the websites. These are very easy to use algorithms. There are also controls developed by third parties for preventing automatic registrations.
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________
to our mailing list and receive new articles
: We never rent, trade, or sell my email lists to
Visit .NET Programming Tutorial Homepage