Apply a license key in IronQR

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>
XML

Setting license key in web.config issue

There is a known licensing issue: in ASP.NET projects targeted .NET framework version >= 4.6.2. The key stored in a web.config file will NOT be picked up and used by the product.

To work around this issue it is recommended to read license key using ConfigurationManager from web.config in the code and apply it to the License.LicenseKey.

Example

With the above XML file, we can use ConfigurationManager to retrieve and pass the license key value to IronQr.License.LicenseKey property.

using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];

IronQr.License.LicenseKey = licenseKey;
using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];

IronQr.License.LicenseKey = licenseKey;
Imports System.Configuration

Private licenseKey As String = ConfigurationManager.AppSettings("IronQr.LicenseKey")

IronQr.License.LicenseKey = licenseKey
VB   C#

__

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

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

Add a JSON file to your project called appsettings.json in the root directory of your project Add a 'IronQr.LicenseKey' key to your JSON config file. The value should be your license key. 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.

bool result = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01");

// Check if IronQR is licensed successfully 
bool is_licensed = IronQr.License.IsLicensed;
bool result = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01");

// Check if IronQR is licensed successfully 
bool is_licensed = IronQr.License.IsLicensed;
Dim result As Boolean = IronQr.License.IsValidLicense("IRONQR-MYLICENSE-KEY-1EF01")

' Check if IronQR is licensed successfully 
Dim is_licensed As Boolean = IronQr.License.IsLicensed
VB   C#