English

How To: Authorize an ESLF file

Summary

The ESRI Secure License File (ESLF) technology allows OEM customers to authorize ArcGIS Engine version 10.0 SP5, and later, on any computer. The authorization is done against a secure license file (*.eslf). This file may or may not be encrypted (in this context, encryption means that the file has a password associated with it).

To authorize Engine using the ESLF file technology, it is necessary to write ArcObjects code. There are currently two APIs one can use with the ESLF technology: the .NET and cross-platform C++ APIs. Below is a .NET ArcObjects code sample that shows how to authorize ArcGIS Engine using an encrypted ESLF file. For an unencrypted file, simply pass in an empty string as the password.

Procedure

static void Main(string[] args)
{
    ESRI.ArcGIS.RuntimeManager.Bind(ProductCode.Engine); // Bind to the Engine Product.
    ESRI.ArcGIS.esriSystem.IAuthorizeLicense aoAuthorizeLicense = new ESRI.ArcGIS.esriSystem.AoAuthorizeLicenseClass();
    try
    {
        string pathToLicenseFile = @"C:\temp\SomeLicenseFile.eslf";
        string password = "SomePassword"; // pass an empty string if the ESLF file is not encrypted
        aoAuthorizeLicense.AuthorizeASRFromFile(pathToLicenseFile, password); // Authorize Engine here
        string featuresAdded = aoAuthorizeLicense.FeaturesAdded; // Check if authorization succeeded
        System.Diagnostics.Debug.WriteLine("Features Added: " + featuresAdded);
    }
    catch (Exception e)
    {
        string lastError;
        int errorNumber = aoAuthorizeLicense.get_LastError(out lastError);
        System.Diagnostics.Debug.WriteLine("Error Number " + errorNumber + " : " + e.Message + ". Last Error: " + lastError);
    }

    // Check if the Engine Product Code is available (to check if authorization succeeded)
    ESRI.ArcGIS.esriSystem.IAoInitialize aoInitialize = new ESRI.ArcGIS.esriSystem.AoInitialize();
    ESRI.ArcGIS.esriSystem.esriLicenseStatus esriLicense_Status = aoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngine);
    System.Diagnostics.Debug.WriteLine("esriLicenseStatus: " + esriLicense_Status);
}