Sky Software Homepage LogicNP Software Knowledge Base And FAQ

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

HOWTO: Use a single license service for multiple project files.

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



Joined: 18 Jul 2005
Posts: 731

Posted: Thu Dec 10, 2009 4:20 am    Post subject: HOWTO: Use a single license service for multiple project files.

v2010 or later of CryptoLicensing supports using a single license service for multiple project files.

Internet Deployed License Service

The license service settings file (named settings.xml by default and located in the App_Data folder) is simply an XML file which specifies which license project file to use when servicing requests (and the database connection string). Thus there is a one-to-one correspondence with the settings file and the license project file specified therein.

To use the same license service for multiple project files, make a copy of the settings.xml file. You can then manually edit them to specify the license project file and database connection string or you can use the install/install.aspx page that comes with the license service.

Once the settings files are configured, loading the correct settings file when communicating with the license service works by using the CryptoLicense.LicenseServiceSettingsFilePath property: This property explicitly specifies the settings file to use when communicating with the license service. When this property is specified, the LicenseService.DefaultSettingsFilePath property (see note below) is ignored.

Example

You wish to use the same license service for two products: MyProduct1 and MyProduct2. In this case, the App_Data folder will contain the following files:

MyProduct1.netlicproj (the license project file for MyProduct1)
MyProduct2.netlicproj (the license project file for MyProduct2)
MyProduct1_settings.xml (the settings file for MyProduct1 which specifies the MyProduct1.netlicproj file above)
MyProduct2_settings.xml (the settings file for MyProduct2 which specifies the MyProduct2.netlicproj file above)

When validating licenses from MyProduct1, use the following code:

Code:
cryLic.ValidationKey="...";
cryLic.LicenseCode="...";
cryLic.LicenseServiceURL="...";
cryLic.LicenseServiceSettingsFilePath=@"%AppDomainAppPath%App_Data\MyProduct1_settings.xml";
if(cryLic.Status==LicenseStatus.Valid)
{
...
...
}


When validating licenses from MyProduct2, use the following code:

Code:
cryLic.ValidationKey="...";
cryLic.LicenseCode="...";
cryLic.LicenseServiceURL="...";
cryLic.LicenseServiceSettingsFilePath=@"%AppDomainAppPath%App_Data\MyProduct2_settings.xml";
if(cryLic.Status==LicenseStatus.Valid)
{
...
...
}


Notes

    * LicenseService.DefaultSettingsFilePath property: When you create a new license service, the LicenseService.DefaultSettingsFilePath property is set to the path of the one and only settings.xml file created in the App-Data folder. This is the settings file that is used if no CryptoLicense.LicenseServiceSettingsFilePath property (see above) is specified.

    * The same database/connection string can be used for all the projects. However, be sure to specify a different Table Name Prefix via the install.aspx page. This ensures that different tables are created and used for each settings file.



Customer Deployed License Service (For Network Floating Licenses)

The license service settings file (named settings.xml by default and located in the App_Data folder) is simply an XML file which specifies which encrypted storage file (.psf) to use when servicing requests. Thus there is a one-to-one correspondence with the settings file and the encrypted storage file specified therein.

To use the same license service for multiple project files:


    - Open the first .netlicproj file and create a customer-deployed floating license service for that project in one folder (say Folder1).
    - Open the second .netlicproj file and create a customer-deployed floating license service for that project in another folder (say Folder2).
    - Rename settings.xml file from Folder2\App_Data to settings_MyProduct2.xml (as example).
    - Rename storage.psf file from Folder2\App_Data to storage_MyProduct2.psf (as example).
    - Open the renamed file settings_MyProduct2.xml in a text editor and change the reference to storage.psf to storage_MyProduct2.psf
    - Optionally, follow above three steps for the corresponding files for Product1 in Folder1\App_Data
    - Copy files settings_MyProduct2.xml and storage_MyProduct2.psf from Folder2\App_Data to Folder1\App_Data



Once the settings files are configured, loading the correct settings file when communicating with the license service works by using the CryptoLicense.LicenseServiceSettingsFilePath property: This property explicitly specifies the settings file to use when communicating with the license service. When this property is specified, the LicenseService.DefaultSettingsFilePath property (see note below) is ignored.

When validating licenses from MyProduct1, use the following code:

Code:
cryLic.ValidationKey="...";
cryLic.LicenseCode="...";
cryLic.LicenseServiceURL="...";
cryLic.LicenseServiceSettingsFilePath=@"%AppDomainAppPath%App_Data\settings_MyProduct1.xml";
if(cryLic.Status==LicenseStatus.Valid)
{
...
...
}


When validating licenses from MyProduct2, use the following code:

Code:
cryLic.ValidationKey="...";
cryLic.LicenseCode="...";
cryLic.LicenseServiceURL="...";
cryLic.LicenseServiceSettingsFilePath=@"%AppDomainAppPath%App_Data\settings_MyProduct2.xml";
if(cryLic.Status==LicenseStatus.Valid)
{
...
...
}


Note

LicenseService.DefaultSettingsFilePath property: When you create a new license service, the LicenseService.DefaultSettingsFilePath property is set to the path of the one and only settings.xml file created in the App-Data folder. This is the settings file that is used if no CryptoLicense.LicenseServiceSettingsFilePath property (see above) is specified.[/list]
Back to top
Display posts from previous:   
Forum Index -> CryptoLicensing For .Net All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group