.NET Licensing

I'm going to put the license component in my .Net program and considering the license for developer and run time.Microsoft already provide several licensing model in .NET such as Registry or Lic File.As for me, I'm prefer to use WMI with a propitiatory algorithm such as encryption to generate the license as I can generate an unique license key for each computer.

This how we could do that :

For Developer (Design Time) :

if (System.ComponentModel.LicenseManager.CurrentContext.UsageMode ==
System.ComponentModel.LicenseUsageMode.Designtime)
{
throw new System.Exception("Design Time License Required");
}



For run time :


if (System.ComponentModel.LicenseManager.CurrentContext.UsageMode == System.ComponentModel.LicenseUsageMode.Runtime)
{
throw new System.Exception("Run Time License Required");
}


For more details you can refer to these links :

  1. http://www.developer.com/net/net/article.php/11087_3074001_1/Applications-Licensing-using-the-NET-Framework.htm
  2. http://msdn.microsoft.com/en-us/library/fe8b1eh9.aspx

0 comments:

 
Copyright © peyotest