I have developed a software program using c#.net and with sql server express. When I put this into production environment this should be able only for people who has a get the software by me.
Eg: If I have issues a license, it should be valid only to a particular person. Even though that person hands over that key to another person it should not be worked.

please mention some methodology to accomplish this task

thank you.

5 Years
Discussion Span
Last Post by skatamatic

When the user enters the license code it will contact a license server over the internet. The server will verify that license code has never been used before and send back a second activation key specific to the requesting machine (the license validation request from the client should also include machine-specific data such as the computer sid, machine name, etc). I believe Flexera Software (InstallShield) also offers licensing activation services. It would probably be easier to purchase a service than roll your own.

To get the machine SID (in theory it will be unique to every computer, but not always):

using System;
using System.Security.Principal;
using System.DirectoryServices;
using System.Linq;

public static SecurityIdentifier GetComputerSid()
 return new SecurityIdentifier((byte[])new DirectoryEntry(string.Format("WinNT://{0},Computer", Environment.MachineName)).Children.Cast<DirectoryEntry>().First().InvokeGet("objectSID"), 0).AccountDomainSid;

Borrowed from here


but you need a server to do this validation. What in case if there is no server available? No options at all?


Not really... you could make the user call in and validate the license key over the telephone.

In order to ensure a key is not being reused you need a central store to track key activation and a mechanism for the client to contact the central store. This is how Microsoft handles Windows activation. It tries to activate online but if no internet connection is available you can call in and they will read you an activation code.

If this software will only be installed for a single customer and uses a common database you can handle the activation process through the database. Its not necessarily as secure but it would work.


This really depends on how hard you want it to be to crack your software. If you are fine with about 15% of your target market using your software for free, just using a file containing an encrypted key unique to each distribution should work. This way they must enter a CD key in, the program decrypts the license file and compares it with the CD key, then either accepts or denies the install. This is somewhat easy to circumvent, however.

The best way to ensure legitimate use is with a web service. Starcraft 2 and a large number of other recent online games are nearly impossible to play ilegally. This is because unique info about you (your location, mac address, sid, etc) are associated with your cd key/account and stored on a server. If anyone else tries using this cd key it will not work since the key is already associated with you. There are still ways to get around this, but not easily. Using this method expect about 98-99% of your target market to use a licensed copy of your software.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.