ValidateLicenseFile

Validates a license on the server

Description

Validates a QLM license file by performing the following operations:

  • Reads the license file and validates its signature
  • Validates the license based on the information in the license file
  • If server-side validation is enabled, contacts the License Server and validates the license on the server
  • If needed, reactivates the license to retrieve the latest information from the server
 bool ValidateLicenseFile(string webServiceUrl, string licenseFileName, 
                                 string activationKey, string computerID, ELicenseBinding licenseBinding, 
                                 out ILicenseInfo licenseInfo)

Parameters

ParameterTypeDescription
webServiceUrlstringURL to the QLM License Server
licenseFileNamestringpath to the license file
activationKeystringthe activation key
computerIDstringthe unique computer identifier
licenseBindingELicenseBindingthe license binding to use
licenseInfoILicenseInforeturn licenseInfo object

Return

TypeDescription
booltrue if the license is valid.

Remarks

If validation fails, licenseInfo.ServerErrorCode and licenseInfo.ErrorMessage provide additional details.

Example

QLM.LicenseValidator lv = new QLM.LicenseValidator(settingsFile);
string licenseFile = string.Empty;
ELicenseBinding licenseBinding = ELicenseBinding.ComputerName;
ILicenseInfo licenseInfo;

if (!String.IsNullOrEmpty(lv.QlmLicenseObject.LicenseFilePath))
{
  licenseFile = Environment.ExpandEnvironmentVariables(lv.QlmLicenseObject.LicenseFilePath);
}

bool ret = lv.QlmLicenseObject.ValidateLicenseFile(lv.QlmLicenseObject.DefaultWebServiceUrl, 
                                                   licenseFile, string.Empty, string.Empty,
                                                   licenseBinding, out licenseInfo);
if (ret == false)
{
  DisplayLicenseForm(); // Displays the license wizard

  if (lv.QlmLicenseObject.ValidateLicenseFile(lv.QlmLicenseObject.DefaultWebServiceUrl, 
                                              licenseFile, string.Empty, string.Empty, 
                                              licenseBinding, out licenseInfo) == false)
  {
    Environment.Exit(0);
  }
}