1. Home
  2. Docs
  3. .NET Integration
  4. Tutorials
  5. Multi-component license software integration

Multi-component license software integration

A typical integration of your software with licensing is to have 1 license for 1 piece of software.

This means that if a license is invalid then the software will be disabled.  If it is valid then the software will be activated.

Pretty straight-forward setup.

But what if you have one piece of software that contain multiple products? Each with their own licensing?

This is where the overloaded service methods (activate and validate) can be used to control the software license state as well as the individual license states.


Main Product

Identify one product that controls whether the software is activated or deactivated.

This would typically be a core product that everyone must buy to use your software.

So let’s call this Product 1 as entered into the Products area in the License Manager



The rest of the products within your software can be activated and validated individually with no affect on the entire software state.

These products are also as entered into the Products area in the License Manager.

We are just treating them differently to the main product in our software integration.


License State

The next question is how will the software know that each sub-product has been activated after the software has been closed down and re-opened?

This is where license state for each sub-product needs to be stored by our software.

The CPS DLL automatically stores state for a Main Product, however you will need to implement this part yourself if you are also using sub-products.



The sample .NET project can be added to in order to demonstrate the use of sub-product activation and validation.

Here it is activated for 1 product using the normal scenario of 1 product for 1 software application.

Let’s set the scenario that now your software has multiple products you want to license within it.

In our example, we can make each User Control house each sub product.

Each sub-product needs to be independently activated once, and then validated after the software is restarted.


Updated User Control For Sub-Product 1

Here we have just added some text boxes and a button just to activate sub-product 1.

Our activation code added to the user control can be like this.

public void DoActivate(string email, string activationCode, string name)
            var cpsService = new CpsService();

            const string softwareCode = "product2"; // treated as a sub-product

            var cpsServiceResult = cpsService.Activate(email, activationCode, name, softwareCode);

            if (cpsServiceResult.Result)
                lblMessage.Text = cpsServiceResult.Description;
                btnRequestActivation.Enabled = false;

                //Save license state
                Settings.Default.Product2ID = cpsServiceResult.LicenseId;
                Settings.Default.Product2Hash = cpsServiceResult.LicenseHash;
                //Activation issue
                lblMessage.Text = cpsServiceResult.Description;
                btnRequestActivation.Enabled = true;


We have chosen to store individual license state for sub products using the Settings namespace.


Set up each Settings property here

You could also store in a database or file based, etc…

The reason we are storing these values is so that we can pass the LicenseID and LicenseHash value (returned from the Activate method) to the Validate function after the app is re-opened.



After the app is closed and re-opened we need a way to validate that the license for a sub-product has been activated.

public void SetData()
            //in this example, this method is called by the parent form container.
            //We will use this to validate that Sub Product 2 has been activated.

            //lets get any license details that may have been stored by an activation for Sub Product 2
            var licenseID = Settings.Default.Product2ID;
            var licenseHash = Settings.Default.Product2Hash;

            //call validate (works on and offline)
            var cpsService = new CpsService();
            var cpsServiceResult = cpsService.Validate(licenseID, licenseHash);

                //Valid license
                lblMessage.Text = "License is activated";
                btnRequestActivation.Enabled = false;
                //No license - this sub-product needs to be activated
                lblMessage.Text = "License is not activated";
                btnRequestActivation.Enabled = true;



Was this article helpful to you? Yes No

How can we help?