Skip to main content

api-AgileDotNet-Licensing-AgileDotNet-Licensing-AgileDotNetLicenseProvider-CreateLicenseFromString

Creates a AgileDotNetLicense object from its string representation.

Syntax

Visual Basic

Public Shared Sub CreateLicenseFromString( _
   ByVal licenseContent As String _
)

C#

public static AgileDotNetLicense CreateLicenseFromString(
   string licenseContent
);

Parameters

Return Value

A license object

Remarks

The method may be used to install a license on a target machine without distributing the license file along the application.

Example

using System;
using System.ComponentModel;
using AgileDotNet.Licensing;

namespace SecuredNamespace
{
[LicenseProvider(typeof(AgileDotNetLicenseProvider))]
public class SecuredComponent
{
public SecuredComponent(string licenseContent)
{
AgileDotNetLicense license = AgileDotNetLicenseProvider.CreateLicenseFromString(licenseContent);
license.Save("MyLic");

license = LicenseManager.Validate(this.GetType(), this) as AgileDotNetLicense;
}

public void ExecuteProtecteMethod()
{
if (license.IsTrial)
{
// Add your code here
}
else
{
// Add your code here
}
}

private AgileDotNetLicense license;
}
}

See Also

AgileDotNetLicenseProvider Class | AgileDotNet.Licensing Namespace