Introduction and Background
I recently had to create an application with a registration system which would be used by many users at the same time, each of them purchasing their own license.
The idea was the following: the user purchases a license key, which he/she then enters into the application (which could be downloaded freely). The application would contact a central server, which would return an activation request serial number. This would then be sent to the license reseller, who would generate an activation key, which would in turn be entered into the application by the user.
I needed some way of uniquely identifying each computer with ease, to ensure that no two users could use the same license key, yet each user could establish several connections to the server.
In this article, I will show you how I accomplished this task.
The actual code
I solved the problem by making use of the computer name, username, and user domain, the number of processors, and the number of logical drives which are installed on the computer. This way, even a multi-user system would require each user to register their own copy of the application, but no user could use the same license on more than one computer.
First, create a new Windows application, and add a button plus textbox to your form.
button1_click routine, add the following code:
textBox1.Text = Environment.ProcessorCount + "/" + Environment.MachineName + "/" +
Environment.UserDomainName + "\\" +
Environment.UserName + "/" +
The code should be fairly easy to understand.
Points of Interest
The disadvantage to this method is that the same conditions can be simulated, but with some difficulties. This method should not be used where expensive software is licensed - I used this for cheap licensing of small software.
This method still needs some enhancements to be ready for big software.