Embedded Trial Keys in .NET: Ship Evaluation Versions Without a Server

Published: (February 19, 2026 at 10:27 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

Overview

Ship a trial version of your .NET application by embedding a trial key directly in the code. No server, no activation step—users can start evaluating immediately.

Traditional trial approach

  1. User downloads the app.
  2. User registers on your website.
  3. You email a trial key.
  4. User enters the key in the app.
  5. App validates the key online.

Result: 30‑40 % of users drop off before trying the app.

Embedded trial approach

  1. User downloads the app.
  2. The app runs immediately using an embedded trial key.
  3. User evaluates the software.

Result: 100 % trial start rate.

Creating a trial key in QLM

  1. Manage Keys → Create
  2. Product: Your Product
  3. License Model: Trial
  4. Expiry Date: 30 days from today
  5. Number of Licenses: 1
  6. Click OK

Copy the generated key (example: A5B3C-D8E2F-G1H4I-J7K9L-M3N6P).

Sample code (C#)

using System;
using QLM.LicenseLib;

class Program
{
    // Embedded trial key – same for all users
    private const string TRIAL_KEY = "A5B3C-D8E2F-G1H4I-J7K9L-M3N6P";

    static void Main(string[] args)
    {
        if (ValidateLicense())
        {
            Console.WriteLine("Trial active – running app");
            RunApp();
        }
        else
        {
            Console.WriteLine("Trial expired or invalid");
        }
    }

    static bool ValidateLicense()
    {
        var lv = new LicenseValidator("settings.xml");
        bool needsActivation = false;
        string errorMsg = string.Empty;

        // First check if a license exists locally
        bool isValid = lv.ValidateLicenseAtStartup(
            ELicenseBinding.ComputerName,
            ref needsActivation,
            ref errorMsg
        );

        // If no license found, use the embedded trial key
        if (!isValid && string.IsNullOrEmpty(lv.ActivationKey))
        {
            lv.ActivationKey = TRIAL_KEY;
            lv.ComputerKey = string.Empty;

            isValid = lv.ValidateLicenseAtStartup(
                ELicenseBinding.ComputerName,
                ref needsActivation,
                ref errorMsg
            );

            if (isValid)
            {
                // Store trial key locally for subsequent runs
                lv.QlmLicenseObject.StoreKeys(lv.ActivationKey, lv.ComputerKey);
                Console.WriteLine("Trial started – 30 days remaining");
            }
        }

        return isValid;
    }

    static void RunApp()
    {
        // Your application code here
    }

    static void ShowTrialStatus(LicenseValidator lv)
    {
        if (lv.QlmLicenseObject.LicenseModel == ELicenseModel.trial)
        {
            DateTime expiryDate = lv.QlmLicenseObject.ExpiryDate;
            int daysLeft = (expiryDate - DateTime.Now).Days;

            if (daysLeft > 0)
                Console.WriteLine($"Trial: {daysLeft} days remaining");
            else
                Console.WriteLine("Trial expired");
        }
    }
}

How it works

  • First run: No local license is found, so the embedded key is used. The validator checks the key against the expiry date, starts the trial, and stores the key locally.
  • Subsequent runs: The stored license is used, avoiding repeated validation of the embedded key.
  • After 30 days: The license expires and the app stops working until a permanent key is entered.

Upgrading to a permanent license

When a user purchases the product, they enter a permanent key via the QLM License Wizard. The wizard replaces the trial key, and the app validates the new key for indefinite use.

Tracking downloads (optional)

If you need per‑user tracking, generate a unique trial key server‑side when the user downloads the installer and embed that key. This approach requires a server call and defeats the “zero‑friction” advantage of the embedded method.

Pros and cons

✅ Pros❌ Cons
Zero friction – app runs immediatelyCannot identify who tried the app
No server requiredEmbedded key can be extracted (acceptable for trials)
Works offlineSame key for all users
Same binary for trial and paid versions

When to use embedded trial keys

  • Frictionless trial is the top priority.
  • You do not need to track individual trial users.
  • Offline trial support is required.

When to avoid embedded trial keys

  • You need detailed analytics for each download.
  • Unique per‑user keys are required.
  • Trial usage metrics are essential for business decisions.

Platform support

  • 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 (via .NET MAUI, Xamarin)

Pricing (per developer)

EditionPrice
QLM Express$200 / year
QLM Professional$699 / year
QLM Enterprise$999 / year

A 30‑day trial of Quick License Manager (QLM) is available for download.

Further reading

Quick License Manager by Soraco Technologies –

0 views
Back to Blog

Related posts

Read more »

Lambda Expressions in C#

Introduction In C, lambda expressions allow writing anonymous unnamed methods in a short and readable way. They are defined using the => lambda operator. Lambd...