Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Avoid distribution of floating license code to multiple machines.

 
Subscribe to the RSS feed for this forum  Forum Index -> CryptoLicensing For MFC
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Sat Oct 01, 2011 9:43 am    Post subject: HOWTO: Avoid distribution of floating license code to multiple machines.

When using a customer-deployed floating license service, the typical scenario is to send the floating license code to the customer. The customer then distributes the license code internally to all the machines which will use your software. However, in case the customer has hundreds or thousands of machines on their network, this approach can be cumbersome or even unfeasible.

However, you can avoid the customer having to distribute the floating license code to multiple machine using these simple steps:

- Create a license.txt file (or use any other name you like) in the App_Data folder containing the floating license code.

- In the LicenseCode.cs (or .vb) file of your customer-deployed license service, add the following custom web service method to the LicenseServiceClass class:
[C#]
Code:
[WebMethod()]
public string GetLicenseCode()
{
using (StreamReader sr = new StreamReader(GetRealFilePath("%AppDomainAppPath%App_Data\\license.txt")))
  {
  return sr.ReadToEnd();
  }
}

[VB.Net]
Code:
<WebMethod> _
Public Function GetLicenseCode() As String
    Using sr As New StreamReader(GetRealFilePath("%AppDomainAppPath%App_Data\license.txt"))
        Return sr.ReadToEnd()
    End Using
End Function


When invoked, this web service method returns the license code stored in the license.txt file.

- In your actual app, call the above web service method as follows:
Code:
CString licStr;
licStr = lic.QueryWebService(_T("GetLicenseCode"), NULL, NULL,0);
lic.SetLicenseCode(licStr);


The above line will invoke the custom web service method and set the CCryptoLicense.SetLicenseCode() function to the returned license code.

- Now that the license code is loaded into the CryptoLicense instance, you can proceed to validate it as usual using the CCryptoLicense.GetStatus() function.

Using this approach, the customer only needs to save the license code in one place (in the license.txt file in the App_Data folder) instead of having to distribute it to all the machines which need to use the floating license.
Back to top
Display posts from previous:   
Forum Index -> CryptoLicensing For MFC All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group