Apply a license key in IronQR

This article was translated from English: Does it need improvement?
Translated
View the article in English

Set your license using code

The license key is a long string that ends with an expiry date. Please ensure this is copied correctly, with no spaces.

IronQR-MYLICENSE-KEY-1EF01-RENEW.SUPPORT.01.JAN.2050

The most robust method of applying a license key is directly in your code, before the library is called.


Set your license using Web.Config or App.Config

To apply a key globally to your application using Web.Config or App.Config, add the following key to your config file in appSettings.

<configuration>
    ....
    <appSettings>
        <add key="IronQr.LicenseKey" value="IRONQR-MYLICENSE-KEY-1EF01"/>
    </appSettings>
    ....
</configuration>
<configuration>
    ....
    <appSettings>
        <add key="IronQr.LicenseKey" value="IRONQR-MYLICENSE-KEY-1EF01"/>
    </appSettings>
    ....
</configuration>
XML

Set your license key using a .NET Core appsettings.json file

To apply a key globally to your application in a .NET Core application:

  1. Add a JSON file to your project called appsettings.json in the root directory of your project.
  2. Add an IronQr.LicenseKey key to your JSON config file. The value should be your license key.
  3. Ensure that the file properties include Copy to Output Directory: Copy always.

File: appsettings.json

{
    "IronQr.LicenseKey": "IRONQR-MYLICENSE-KEY-1EF01"
}

Test your key

Test if your key has been installed correctly by checking if the license is valid and whether IronQR is licensed successfully.

// Validate the license key
bool result = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01");

// Check if IronQR is licensed successfully 
bool isLicensed = IronQr.License.IsLicensed;

// Output the results
Console.WriteLine("IsValidLicense: " + result);
Console.WriteLine("IsLicensed: " + isLicensed);
// Validate the license key
bool result = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01");

// Check if IronQR is licensed successfully 
bool isLicensed = IronQr.License.IsLicensed;

// Output the results
Console.WriteLine("IsValidLicense: " + result);
Console.WriteLine("IsLicensed: " + isLicensed);
' Validate the license key
Dim result As Boolean = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01")

' Check if IronQR is licensed successfully 
Dim isLicensed As Boolean = IronQr.License.IsLicensed

' Output the results
Console.WriteLine("IsValidLicense: " & result)
Console.WriteLine("IsLicensed: " & isLicensed)
$vbLabelText   $csharpLabel
Curtis Chau
技術作家

Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。

除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。

準備好開始了嗎?
Nuget 下載 47,669 | 版本: 2025.11 剛剛發布