View previous topic :: View next topic |
Author |
Message |
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Sat May 26, 2007 9:02 am Post subject: Licensing components |
|
|
Hello, we are doing some modifications to your code to adapt it to our requirements and we have some questions about licensing:
When you license an application you can set the file that you want, but when you license a control you can not. Is this True? Can we avoid this limitation?
When you register a control used in an application and give a key the license file is set on the results of that application. This way if the application is deleted the control becomes unregistered again. Is this also True? And can we avoid this limitation too?
We have searched for general concepts of licensing in .Net without much success. Do you have any links about the main concepts of .Net licensing?
Thanks in advance. |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Sat May 26, 2007 10:47 am Post subject: |
|
|
Ok, an update here. We have done some tweaking here and there on your classes and now we have this scenario:
When a user registers a component all the namespace beings registered. We have set a unique license file for each namespace and it is being stored in a unique non stardard location to make harder to copy and paste the file.
So, when the components check if there is a valid license they check that location for the file and everything works. We have done this mainly joining your both types of registration (with file and with type) in only one method with file and type.
The only problem we have now is that the .lic runtime license is not automatically added to a project when you add a licensed component thru the Form designer. The .licx contains the reference for the component but the license is not added.
We don't know how to debug this as we don't know how the .lic file is added to the aplication. Can you give us a hint about this? |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Sat May 26, 2007 5:05 pm Post subject: |
|
|
While we wait your anwser we continue investigating so we have now more information. We now know that the .lic is added with the lc.exe tool.
The licenses file that it is creating seems to be empty:
.licenses file contents:
LoadFactorVersionComparerHashCodeProviderHashSizeKeysValues
We have modified the GetLicenseFilePath without success, lc.exe still compiles an empty license file. Do you know wich method calls lc.exe to get the runtime license of a type? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sun May 27, 2007 11:55 pm Post subject: |
|
|
Quote: | When you license an application you can set the file that you want, but when you license a control you can not. Is this True? Can we avoid this limitation? |
For control/components you can still set the file - you just have to do it a bit differently by overriding the GetLicenseFilePath method. See the FAQ on this
Can I license all the controls in a library with one key?
Quote: | So, when the components check if there is a valid license they check that location for the file and everything works. We have done this mainly joining your both types of registration (with file and with type) in only one method with file and type. |
You shouldn't have to modify the ILS code. You simply derive a new class and override the GetLicenseFilePath as described in the FAQ above. Modifying the code may well mess up the mechanism that embeds the runtime license key in the application resources.
Have you read the FAQ on resolving issues with runtime licenses?
Why aren't runtime licenses working for my component? _________________ Infralution Support |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Mon May 28, 2007 5:32 pm Post subject: |
|
|
Ok, we will try to create a class that inherits from yours. As we have developed a license server we modified yours to make things a bit easier but after checking the modifications all can be done outside the ILS so we will try your approach.
On the other side we have checked all the FAQ items but with the code modified we were unsure about the results obtained. We will tell you how is it going when we end the modifications.
Thanks. |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Mon May 28, 2007 7:27 pm Post subject: |
|
|
Ok, now everything works as expected. Usually we haven't the source code of the components we buy and looks like that we couldn't stop touching the code
Just a question, there is a way of validating a key without installing the license? Reading the docs we tryed the LicenseProvider.ValidateLicenseKey(key) but it throws an Exception because on LoadLicense the type parameter is set to nothing. Any hint about this?
Thanks for your help. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon May 28, 2007 10:16 pm Post subject: |
|
|
ValidateLicenseKey is the method you want.
I've just double checked the code, LoadLicense does not throw an exception if the type parameter is null. It does however throw an exception if you haven't set the parameters prior to calling it.
Do do this you should call LicenseProvider.SetParameters before calling LicenseProvider.ValidateLicenseKey(key). Alternatively you can use the overloaded version of ValidateLicenseKey(key, parameters).
Are you sure you haven't modified this code? What are the details of the exception you are getting. _________________ Infralution Support |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Tue May 29, 2007 7:04 am Post subject: |
|
|
As far as I remember (I have not the source code at hand now) the exception is thrown at context.SetSavedLinceseKey(type,runtimeLicenseKey) with type = Nothing.
The code is untouched as we reimported your source code on our solution.
I will try to take an screenshoot of the exception tatter. The exception is not thrown because of the Try Catch but the result is nothing always. |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Tue May 29, 2007 6:12 pm Post subject: |
|
|
You can see here the screenshot of the exception being debugged. The parameters of the EncriptedLicenseProvider have values inside the array so the SetParameters has been called.
The runtimeLicenseKey had a value before entering the Catch block so IMHO the problem has to be with the type that is set to Nothing.
The call stack is
From our registration form:
Code: |
LicenseProvider.ValidateLicenseKey(ByVal key As String)
EncriptedLicenseProvider.ValidateLicenseKey(ByVal licenseKey As String)
EncriptedLicenseProvider.LoadLicense(ByVal context As LicenseContext, ByVal type As Type, ByVal licenseKey As String)
|
|
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue May 29, 2007 10:16 pm Post subject: |
|
|
I didn't realize you were using the VB version of the code. There is indeed an an issue in the VB version of the code. The check above that block should be:
Code: | If context.UsageMode = LicenseUsageMode.Designtime And Not type Is Nothing Then |
We will fix this in our released source.
PS: Please note we generally prefer that you don't post segments of the source code to the forums. In this case the code in question does not reveal much so its not really a problem, but in future it is better to email us with questions related to source code. _________________ Infralution Support |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Wed May 30, 2007 6:38 am Post subject: |
|
|
Sure! I'm really sorry that I didn't see that this was displaying your source code. It's not a problem, I will hide almost all the code on the image hosted at my server in a few hours.
With that check (not type is nothing) I think everything will work as expected. Thanks a lot. |
|
Back to top |
|
|
issoft
Joined: 30 Apr 2007 Posts: 13
|
Posted: Wed May 30, 2007 5:41 pm Post subject: |
|
|
Image fixed, licensing working and server integrated with the License Tracker working.
Again, thanks for your support.
ISSoft Developers. |
|
Back to top |
|
|
|