The QlmLicense.StoreKeys method is a helper funcion to store license keys on the end user system.
There are several properties that control how keys are stored:
- StoreKeysLocation: this property determines where the license is stored. License keys can be stored in the registry or the file system
- StoreKeysOptions: this propery determines at which level, in the registry or the file system, the license keys are stored. The keys can be stored at the machine level or at the user level. Keys stored at the machine level are visible to all users. Keys stored at the user level are visible to the currently logged on user. The possible values for this property are: user level only, machine level only or both. Note that even if you select to store keys at the machine level, if a user does not have the required privileges to write data at the machine level, the operation will fail silently. This is very common in enterprises. In this scenario, if multiple users login to the same computer, each user will be required to activate the license. To circumvent this limitation, a user could run your application as Administrator (Run As Administrator) then activate the license.
- FavorMachineLevelLicenseKey: this properly controls the behavior of the corresponding ReadKeys method. Assuming a key was stored both at the user level and at the machine level, you may select the order that the ReadKeys method follows to retrieve the keys.
In some scenarios where your solution consists of multiple executables that share the same license key, and if these executables do not run in the same user context, it may be tricky to share the same key location. For example, if your application consists of a windows desktop application and an ASP.NET web application running on the same system. When the web application tries to store keys, it is typically running in the context of a user associated to IIS (such as IUSR_). These users do not typically have privileges to write data at the machine level so the key will be stored at the user level. The desktop application will not see the key because it is running in the context of the logged user who is different than the ASP.NET user (check the application pool associated to your web service to determine that user). In these situations, users will simply have to activate their keys multiple times. Activating a key multiple times from the same computer does not consume additonal activations if the computer identifier used during activation remains the same.
Note that the ReadKeys and StoreKeys method are purely helper functions. You may opt to not use these methods and implement your own methods to persist license keys. For example, if your application's settings are stored in a database, you may elect to store license keys in the database as well.