Skip to main content
Matrix42 Self-Service Help Center

Sample c# Code to check license key (certificate)

Introduction

We recommend to protect your Addon by checking the availability of a purchased license certificate in the customer installation.

Matrix42 Marketplace offers you as Partner the possibility to create your own license certificate.

Request your certificate templates

Please ask the Marketplace team to create the certificate templates for you Addon: e.g. M42MPLYOURNAMEEval30 and M42MPLYOURNAME
Matrix42 Sales Administration SalesAdministration@matrix42.com will take over the creation of the certificate templates in the near future.

C# Code

Please add a assembly reference to the assembly update4u.SPS.Licensing.dll and add the following code in your Addon.


private void IsLicensed()
{
    //throw an exception if the certificate is missing
    if (!update4u.SPS.Licensing.Provider.Instance.IsLicensed("M42MPLYOURNAMEEval30")
        && !update4u.SPS.Licensing.Provider.Instance.IsLicensed("M42MPLYourName"))
    {
        throw new Exception("There is no valid activation key. Please contact Matrix42.");
    }
}    

Invoke the method

Afterwards just call the method "IsLicensed()" in a central place in your Addon. If the certificate is not found the functionality of your Addon will be blocked.

  • Was this article helpful?