PLUSManaged: Activating and Getting a License File (Online Method)

Online activation is one option for activating an application and retrieving a license file from SOLO Server. Obtaining a license file from SOLO Server is required when working with read-only license files, since only SOLO Server has the encryption key data necessary to encrypt and digitally sign a read-only license file. Although it is possible to create a self-signed writable license file without using SOLO Server, it is often more convenient to obtain the base license file from SOLO Server that can then be modified as necessary. Either way, the procedure is largely the same. The only difference being the class from which your license implementation class is derived.

Important

Activation is only intended to occur once per system and/or user. DO NOT configure your application to activate automatically every time it is run, as this can cause many problems that affect the reliability of your application, and is considered a misuse of the SOLO Server activation web services. If you wish to validate the status of the license with SOLO Server in your application, use background checking. If you wish to offer a limited number of users an option to check-in/check-out seats for a license, consider using Network Floating Licensing features for this purpose.

The following guide extends on the example license implementation to demonstrate activating an installation, retrieving a license file from SOLO Server, and then saving that license file to disk. For all example code excerpts, [License File Path] should be replaced with the actual path to your license file (which you may store in a constant or property in your license implementation class).

Online Activation

Important

If you are using or planning to use PLUSManagedGui in your application, this content may not be relevant to you since PLUSManagedGui automatically handles common functionality.

PLUSManaged has different ways of calling to the SOLO Server web services. Typically, you will only need to perform activation from your license implementation code, which inherits from License or WritableLicense.  License and WritableLicense both contain methods which simplify calling SOLO Server web services.  The example code excerpt below illustrates how your application's license implementation class may leverage these convenience methods to support activation.

C#
public bool ActivateOnline(Int32 licenseId, string password)
{
//initialize the object used for calling the web service method
XmlActivationService ws = new XmlActivationService();

string lfContent = "";
if (!this.ActivateInstallationLicenseFile(licenseId, password, ws, ref lfContent))
return false;


//try to save the license file to the file system
try
{
File.WriteAllText("[License File Path]", lfContent);
}
catch (Exception ex)
{
this.LastError = new LicenseError(LicenseError.ERROR_COULD_NOT_SAVE_LICENSE, ex);
return false;
}

return true;
}
VB.NET
Public Overloads Function ActivateOnline(ByVal licenseId As Int32, ByVal password As String) As Boolean
'initialize the object used for calling the web service method
Dim ws As New XmlActivationService()

Dim lfContent As String = ""
If Not Me.ActivateInstallationLicenseFile(licenseId, password, ws, lfContent) Then
Return False
End If

'try to save the license file to the file system
Try
File.WriteAllText("[License File Path]", lfContent)
Catch ex As Exception
Me.LastError = New LicenseError(LicenseError.ERROR_COULD_NOT_SAVE_LICENSE, ex)
Return False
End Try

Return True
End Function