Setting up a software licensing system for .NET applications can easily be done in two ways. In the past, one common way was to code a simple license key generator and a subset of license keys that the code validates. However, given the many benefits of such a solution, most companies have today chosen the second way, which is to outsource software licensing to a Licensing as a Service provider. This blog will dig deeper into these two options to help you set up software licensing for a .NET project.
Now, why are license key generators no longer the preferred chose for licensing .NET code? It has a lot to do with both scalability and flexibility. A simple self-coded key generator only performs partial license key verification, making the process of checking the license keys less secure. Additionally, the subset of license keys and the structure used to generate them will start to break after some time. These reasons makes self-coded licensing systems easy to bypass and troublesome to maintain. You can read more about this option in this blog post.
The preferred method of licensing .NET applications today is by outsourcing licensing to experts. A Licensing as a Service (LaaS) provider such as Devolens will provide you with advanced licensing features that you can access from an easy-to-use dashboard from day 1. We have comprehensive implementation guides in .NET, along with other languages. Implementing our cloud-based licensing solution is effortless!
The first step to implementing our solution is to sign up to our dashboard. We have a free plan to use during the implementation phase, so there is no rush! Our .NET SDK can be downloaded for free, and you only have to paste a short code snippet into your application's code. Our full documentation page is available for reference, but to verify a license key, a similar code to the one below can be used.
var licenseKey = "GEBNC-WZZJD-VJIHG-GCMVD"; // <-- remember to change this to your license key
var RSAPubKey = "enter the RSA Public key here";
var auth = "access token with permission to access the activate method";
var result = Key.Activate(token: auth, parameters: new ActivateModel()
{
Key = licenseKey,
ProductId = 3349, // <-- remember to change this to your Product Id
Sign = true,
MachineCode = Helpers.GetMachineCodePI(v: 2)
});
if (result == null || result.Result == ResultType.Error ||
!result.LicenseKey.HasValidSignature(RSAPubKey).IsValid())
{
// an error occurred or the key is invalid or it cannot be activated
// (eg. the limit of activated devices was achieved)
Console.WriteLine("The license does not work.");
}
else
{
// everything went fine if we are here!
Console.WriteLine("The license is valid!");
}
Console.ReadLine();
More examples can be found here.
Join hundreds of industry-leading software companies who have already chosen us as their software licensing system.