NGWS frameworks provides a licensing model that is the same for Win Forms controls, Web Forms controls, and all components. It is fully compatible with licensing for ActiveX controls.
Licensing allows control authors to protect intellectual property by checking that a user is authorized to use the control. This check is more important at design time, when the control is incorporated into an application, than at run time. When a licensed control is used legally at design time (and it cannot be used otherwise), the application gets a run time license that can be freely distributed.
The licensing model enables the above scenario, and allows many other levels of licensing support. This is accomplished by separating the validation logic from the component or control. The granting of licenses and the validation logic is performed by a license provider, which is a class that derives from System.ComponentModel.LicenseProvider. The steps that a component author must take in order to enable licensing are simple.
To enable licensing for your component you must
A Win Forms control that implements a simple case of licensing is shown in the code example below.
[C#] [LicenseProvider(typeof(LicFileLicenseProvider))] public class MyControl : RichControl { private License license = null; public MyControl () { license = LicenseManager.Validate(typeof(MyControl), this); } public override void Dispose() { if (license != null) { license.Dispose(); license = null; } } protected override void Finalize() { Dispose(); base.Finalize(); } }
A Web Forms control that implements a simple case of licensing is shown in the code example below.
[C#] using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; [LicenseProvider(typeof(LicFileLicenseProvider))] public class MyControl : WebControl { private License license; public MyControl() { license = LicenseManager.Validate( typeof(MyControl), this); } protected override void Dispose() { if (license != null) { license.Dispose(); license = null; } } }
A sample of Licensing is provided in the Win Forms Quickstart.