Manual Activation Dialog
If you want to support manual activation (see Manually Activate a License) in your application you need to implement a Manual Activation dialog to:
- Capture the Activation key, validate the key and create a Manual Activation request.
- Export the Activation Request in text file that can be submitted to the Software Potential Activation Service
- Navigate to the activated license file and install the license
The following applies only to the legacy SLP (aka Microsoft.Licensing) runtime. To implement manual activation using SpAgent please Submitting Activation Requests
Generate 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);
- Save the request string in a text file so it can be submitted to the Software Potential service for processing.
The following code snippet shows how to use the ILicenseBuilder in the legacy SLP runtime to create the manual request string:
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(); } }
The file containing the activation request can then be submitted to the Software Potential Manual Activation site at http://manualactivation.softwarepotential.com. On successful activation, the corresponding license file (.bin file) can be downloaded and installed on the device.
As an alternative to the Software Potential Manual Activation site, you can provide your own branded public web page. You can find a sample MVC application for such a web page on our GitHub account Manual Activation Sample (uses Sp.Agent Nuget).
Install the license
To install the license on the machine that originated the activation request, in your application's Activation dialog you will need to:
- To locate the license file downloaded from the Software Potential Activation Service and
- Install the license in the license store.
The following code snippet installs the license from the license (.bin) file downloaded from the Software Potential Activation service.
private static void InstallLicenseFromFile( string permShortcode, string licenseFilename ) { using ( var runtime = new SLMRuntime(permShortcode) ) { var license = runtime.Licenses.OpenLicense( licenseFilename ); runtime.Licenses.InstallLicense( license ); } }
Comments
0 comments
Article is closed for comments.