Background
The standard Activation Wizard of the SLP (aka Microsoft.Licensing) runtime allows a customer to manually activate a license on a device that does not have direct internet access.
If you want to support manual activation (see FAQ114) in your custom Activation Dialog you need to provide the following functionality as per the sample Manual Activation Dialog below:
- Capture the Activation key, validate the key and create a Manual Activation request.
- Display the Activation Request string in a Textbox.
- Save the request as a text file (and optionally allow it to be copied to the clipboard).
- Navigate to the received license file and then install the license.
Once the Activation Request has been copied the customer must submit this to the Software Potential service for processing. This is done by uploading the request text file to the Software Potential Manual Activation site at http://manualactivation.softwarepotential.com and then download license file on successful activation.
Alternatively, you could create your own branded web page to allow customers to both submit manual Activation Requests and retrieve license files.
Implementation Steps
The following steps include code snippets for both the classic Microsoft.Licensing and new Sp.Agent runtimes.
Step 1: Generating Manual Activation Request
To create a manual Activation request you will need to
- Capture the Activation Key;
- Generate the Manual Activation request as a string (see code below);
- Store the request string to a text file that can be uploaded to the Software Potential service for processing. It is recommended to use the 5x5 Activation Key as the file name.
With Sp.Agent NuGet packages:
string requestString = SpAgent.Product.Activation.Advanced().CreateManualActivationRequest(activationKey, null);
With Microsoft.Licensing Runtime:
string permShortcode = "abc12"; //TODO: substitute in you vendor's own permutation short code.
private static string CreateManualActivationRequestString( string permShortcode, string activationKey )
{
using ( var runtime = new SLMRuntime(permShortcode) )
{
ILicenseRequestBuilder licenseRequestBuilder = runtime.Activation.GetLicenseRequestBuilder( activationKey );
licenseRequestBuilder.AddAvailableLicenseStores();
}
}
Step 2: Submitting Manual Activation Requests to SP Activation Service.
There are two options for request submission and and retrieval of the resulting license file on successful activation:
- Process the request using the page in the Software Potential Manual Activation site at http://manualactivation.softwarepotential.com and download the resultant license file on successful activation.
- Provide your own branded public web page where a customer can submit a Manual Activation request directly and then download the resultant license file on successful activation. Removing the need for your manual intervention simplifies and shortens the Manual Activation process.
You can find a sample MVC application for such a web page on our GitHub account Manual Activation Sample (uses Sp.Agent Nuget).
Step 3: Install the license file on the machine that originated the activation request.
To install the retrieved license file, in your application you will need
- A UI to load/store the license file and
- A mechanism to extract and store the license in the license store.
With Sp.Agent NuGet packages:
//Read the license file into byte[] var licenseBlob = File.ReadAllBytes(@"U:\file.bin "); //Install the license file "file.bin" SpAgent.Product.Stores.Install(licenseBlob);
In Microsoft.Licensing runtime:
private static void InstallLicenseFromFile( string permShortcode, string licenseFilename ) { using ( var runtime = new SLMRuntime(permShortcode) ) { var license = runtime.Licenses.OpenLicense( licenseFilename ); runtime.Licenses.InstallLicense( license ); } }
License File Locking
If the license is Machine Locked the license (.bin) file returned on successful activation can only be used on the machine on which the activation request was generated.
If the license is not Machine Locked the license file resulting from manual activation can be installed on an unlimited number of machines.
Comments
0 comments
Article is closed for comments.