# ValidateLicenseEx

### Description

Validates a computer-bound license key.

```csharp
string ValidateLicenseEx (string computeKey, string ComputerID)
```

### Arguments

| Name        | Data Type | Description                |
| ----------- | :-------: | -------------------------- |
| computerKey |   string  | computer-bound license key |
| computerID  |   string  | computer identifier        |

### Return

| Data Type | Description                                                                                                                            |
| :-------: | -------------------------------------------------------------------------------------------------------------------------------------- |
|   string  | A message indicating the result of the validation. Do not parse this message. Use GetStatus to get the exact status of the validation. |

### Remarks

Prior to calling this function, you must:

* Call [DefineProduct](/docs/api-reference/.net-api/qlmlicense/client-side-methods/defineproduct.md)
* Set the PublicKey property

You can call this function for any type of license key. If the license key is not computer-bound, set the ComputerID to an empty string.

After calling this function, call [GetStatus ](/docs/api-reference/.net-api/qlmlicense/client-side-methods/getstatus.md)to get the status of the call.

### Example

{% code overflow="wrap" %}

```csharp
string returnMsg = license.ValidateLicenseEx(licenseKey, computerID);
bool ret = false;
bool needsActivation = true;

int nStatus = (int)license.GetStatus();

if (IsTrue(nStatus, (int)ELicenseStatus.EKeyInvalid) ||
    IsTrue(nStatus, (int)ELicenseStatus.EKeyProductInvalid) ||
    IsTrue(nStatus, (int)ELicenseStatus.EKeyMachineInvalid) ||
    IsTrue(nStatus, (int)ELicenseStatus.EKeyExceededAllowedInstances) ||
    IsTrue(nStatus, (int)ELicenseStatus.EKeyTampered))
{
    // the key is invalid
    ret = false;
}
else if (IsTrue(nStatus, (int)ELicenseStatus.EKeyVersionInvalid))
{
    // wrongProductVersion
    ret = false;
}
else if (IsTrue(nStatus, (int)ELicenseStatus.EKeyDemo))
{
    // The key has an expiry date

    if (IsTrue(nStatus, (int)ELicenseStatus.EKeyExpired))
    {
        // the key has expired
        ret = false;        
    }
    else
    {
        // the key is still valid
        ret = true;
        // call license.DaysLeft to get the remaining days
    }
}
else if (IsTrue(nStatus, (int)ELicenseStatus.EKeyPermanent))
{
    // the key is valid and permanent
    ret = true;
}

if (ret == true)
{

    if (license.IsActivationLicense (license.LicenseType))
    {
        needsActivation = true;
        ret = false;
    }                
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.soraco.co/docs/api-reference/.net-api/qlmlicense/client-side-methods/validatelicenseex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
