# ValidateLicenseFile

### 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

```csharp
 bool ValidateLicenseFile(string webServiceUrl, string licenseFileName, 
                                 string activationKey, string computerID, ELicenseBinding licenseBinding, 
                                 out ILicenseInfo licenseInfo)

```

### Parameters

| Parameter       |                                         Type                                        | Description                    |
| --------------- | :---------------------------------------------------------------------------------: | ------------------------------ |
| webServiceUrl   |                                        string                                       | URL to the QLM License Server  |
| licenseFileName |                                        string                                       | path to the license file       |
| activationKey   |                                        string                                       | the activation key             |
| computerID      |                                        string                                       | the unique computer identifier |
| licenseBinding  | [ELicenseBinding](/docs/api-reference/.net-api/qlmlicense/enums/elicensebinding.md) | the license binding to use     |
| licenseInfo     |             [ILicenseInfo](/docs/api-reference/.net-api/ilicenseinfo.md)            | return licenseInfo object      |

### Return

| Type | Description                   |
| ---- | ----------------------------- |
| bool | true if the license is valid. |

### Remarks

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

### Example

```csharp
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);
  }
}
```


---

# 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/application-methods/validatelicensefile.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.
