Your .NET application needs license protection. Here's the simplest way to add it — 10 lines of code.
The Problem
You built a great app. Now you want to:
- Stop unauthorized copies
- Issue trial licenses
- Track activations
- Manage subscriptions
Solution: Add license validation at startup.
The Code
using QLM.LicenseLib;
static void Main(string[] args)
{
var lv = new LicenseValidator("settings.xml");
bool needsActivation = false;
string errorMsg = string.Empty;
bool isValid = lv.ValidateLicenseAtStartup(
ELicenseBinding.ComputerName,
ref needsActivation,
ref errorMsg
);
if (!isValid || needsActivation)
{
Console.WriteLine("License invalid: " + errorMsg);
return;
}
// Your app code here
Console.WriteLine("License valid - running app");
}
That's it. 10 lines.
How It Works
ValidateLicenseAtStartup does 5 things:
- Looks for a license stored locally
- Validates the signature (RSA-2048 encryption)
- Checks expiry date (for trials/subscriptions)
- Validates online (optional server check)
- Returns true/false
If no license exists, needsActivation is set to true.
Hardware Binding Options
Tie licenses to specific computers:
ELicenseBinding.ComputerName // Computer name
ELicenseBinding.MacAddress // MAC address
ELicenseBinding.MotherboardSerialNumber // Motherboard
ELicenseBinding.HardDiskSerialNumber // Hard drive
Most common: ComputerName (easy for users, good enough security)
Most secure: MotherboardSerialNumber (survives OS reinstalls)
What About the License Wizard?
You'll want a UI for activation. QLM includes one:
if (!isValid || needsActivation)
{
// Launch QLM License Wizard
System.Diagnostics.Process.Start("QlmLicenseWizard.exe",
"/settings \"settings.xml\"");
// Re-validate after activation
isValid = lv.ValidateLicenseAtStartup(
ELicenseBinding.ComputerName,
ref needsActivation,
ref errorMsg
);
}
The wizard handles:
- Online activation
- Offline activation
- Trial key entry
- Purchase links
Real Example: Console App
using System;
using QLM.LicenseLib;
class Program
{
static LicenseValidator lv;
static string settingsFile = "Demo 1.0.lw.xml";
static void Main(string[] args)
{
if (ValidateLicense())
{
RunApp();
}
else
{
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
static bool ValidateLicense()
{
lv = new LicenseValidator(settingsFile);
bool needsActivation = false;
string errorMsg = string.Empty;
bool isValid = lv.ValidateLicenseAtStartup(
ELicenseBinding.ComputerName,
ref needsActivation,
ref errorMsg
);
if (!isValid || needsActivation)
{
Console.WriteLine("License validation failed: " + errorMsg);
Console.WriteLine("Please activate your license.");
return false;
}
return true;
}
static void RunApp()
{
Console.WriteLine("License valid!");
Console.WriteLine("Running application...");
// Your app logic here
}
}
Supported Platforms
- Windows: .NET Framework 2.x / 4.x, .NET 6/7/8/9/10
- Cross-platform: .NET 6/7/8/9/10 (macOS, Linux)
- Mobile: Android, iOS (.NET MAUI, Xamarin)
Quick License Manager
This uses Quick License Manager (QLM) — the most complete .NET licensing solution.
Pricing (per developer):
- QLM Express: $200/year
- QLM Professional: $699/year
- QLM Enterprise: $999/year
Features:
- RSA-2048 + AES-256 encryption
- Online & offline activation
- 12 e-commerce integrations
- Trial & subscription support
- Floating licenses (Enterprise)
- Customer self-service portal
Resources
- Quick License Manager
- Features
- Pricing
- Tutorials
- Documentation
- ValidateLicenseAtStartup API
- Protect a .NET Core Console App
Related articles:
Got questions about license validation? Drop them in the comments! 👇
Quick License Manager by Soraco Technologies — https://soraco.co
Top comments (0)