How to validate if a license was revoked on the server?
As of version QLM12, please follow the instructions in this article.
To verify if a license was revoked on the server or if a license is illegal, add the code below to your application. If you are using the LicenseValidator class generated by the Protect Your Application wizard, simply set the checkIfLicenseIsRevoked property to true.
You can find the definition of an "Illegal Computer" in the QLM online help.
To revoke a license, locate the license in the Manage Keys tab, click on the Edit button and check the "Disabled" checkbox.
public bool VerifyLicenseOnServer ()
{
bool ret = false;
string webServiceUrl = "https://qlm3.net/qlmdemo/qlmLicenseServer/qlmservice.asmx";
string response;
string qlmVersion = "6.0.00";
string storedActivationKey = string.Empty;
string storedComputerKey = string.Empty;
string computerID = System.Environment.MachineName;
string computerName = System.Environment.MachineName;
QLM.LicenseValidator lv = new QLM.LicenseValidator();
lv.QlmLicense.ReadKeys(ref storedActivationKey, ref storedComputerKey);
if (!String.IsNullOrEmpty(storedActivationKey))
{
if (lv.QlmLicense.IsLicenseKeyRevoked(webServiceUrl, storedActivationKey))
{
MessageBox.Show(String.Format ("License key {0} was revoked.", storedActivationKey));
}
else if (lv.QlmLicense.IsIllegalComputer(webServiceUrl, storedActivationKey, storedComputerKey, computerID, computerName, qlmVersion, out response))
{
ILicenseInfo li = new LicenseInfo();
string message = string.Empty;
lv.QlmLicense.ParseResults(response, ref li, ref message);
MessageBox.Show("Illegal Computer License: " + message);
}
else
{
ret = true;
}
}
return ret;
}Public Function VerifyLicenseOnServer() As Boolean
Dim ret As Boolean = False
Dim webServiceUrl As String = "https://qlm3.net/qlmdemo/qlmLicenseServer/qlmservice.asmx"
Dim response As String = String.Empty
Dim qlmVersion As String = "6.0.00"
Dim storedActivationKey As String = String.Empty
Dim storedComputerKey As String = String.Empty
Dim computerID As String = Environment.MachineName
Dim computerName As String = Environment.MachineName
Dim lv As New QLM.LicenseValidator()
lv.QlmLicenseObject.ReadKeys(storedActivationKey, storedComputerKey)
If Not String.IsNullOrEmpty(storedActivationKey) Then
If lv.QlmLicenseObject.IsLicenseKeyRevoked(webServiceUrl, storedActivationKey) Then
MessageBox.Show(String.Format("License key {0} was revoked.", storedActivationKey))
ElseIf lv.QlmLicenseObject.IsIllegalComputer(webServiceUrl, storedActivationKey, storedComputerKey, computerID, computerName, qlmVersion, response) Then
Dim li As ILicenseInfo = New LicenseInfo()
Dim message As String = String.Empty
lv.QlmLicenseObject.ParseResults(response, li, message)
MessageBox.Show("Illegal Computer License: " & message)
Else
ret = True
End If
End If
Return retEnd Function
Last updated