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>
<configuration>
....
<appSettings>
<add key="IronQr.LicenseKey" value="IRONQR-MYLICENSE-KEY-1EF01"/>
</appSettings>
....
</configuration>
Set your license key using a .NET Core appsettings.json file
To apply a key globally to your application in a .NET Core application:
- Add a JSON file to your project called
appsettings.json
in the root directory of your project. - Add an
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 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)