Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Embedding an Updated Run Time License with ASP.NET

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
FredLarson



Joined: 17 Oct 2005
Posts: 6
Location: Phoenix, AZ

PostPosted: Fri Oct 21, 2005 11:09 pm    Post subject: Embedding an Updated Run Time License with ASP.NET Reply with quote

Hi,

I am using your product to support the licensing of an ASP.NET server control that I have developed.

My question is not so much about the behavior of your product but more the behavior of Visual Studio Net.

As you know, VS supports the server control licensing model by automatically adding a .LICX file to the project when an instance of a licensed control is placed on a web form. Then during the next compile, a run time license is embedded in the DLL of the container. This all works as I would expect.

Here is the catch. If a customer upgrades the original license by replacing the design time license, the run time license is not upgraded. If I delete the original .LICX file and cause another one to be generated by dropping a new instance of my control on a web form, the run time license is upgraded.

Do you know of a way to force an upgrade of the run time license every time the design time license is changed? I would like to make this all transparent to my customers.

Thanks.
_________________
Fred Larson
Back to top
View user's profile Send private message Visit poster's website
FredLarson



Joined: 17 Oct 2005
Posts: 6
Location: Phoenix, AZ

PostPosted: Sat Oct 22, 2005 12:47 am    Post subject: Reply with quote

As a folow-up to my last submisssion, this is a quote from Microsoft:

Quote:
An ASP.NET server control licensing scheme must satisfy the following requirements:

* Support a no-compile scenario. ASP.NET Web applications often use the dynamic compilation model and therefore do not have a precompiled assembly associated with the application. The licensing mechanism should not depend on finding licenses embedded as an assembly resource in the application's assembly.


I notice from your source code that you support this by falling back to finding a .LIC file in the bin directory even at run time. The problem is that in my case the license does exist in the assembly but it is the wrong one.
_________________
Fred Larson
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Oct 23, 2005 11:40 pm    Post subject: Reply with quote

The problem is that VisualStudio caches the compiled license resource and doesn't rebuild it automatically even if the license key changes. The standard way around this is to simply rebuild the solution. This forces Visual Studio to rebuild license resources.

If you don't want the end customer to be aware of this then this may not work for you. An alternative would be to only use design time licenses. Design time license are always read from the lic file (not resources). To do this you would have to explicitly set the LicenseManager.CurrentContext as follows before requesting a license:

Code:

LicenseManager.CurrentContext = new System.ComponentModel.Design.DesigntimeLicenseContext();


The problem with this is that your direct customers would have to distribute your design time license key to their customers - which would enable their customers to use your product at design time.

A third alternative is to bypass using license files altogether and instead provide a programmatic means for your customers to provide your component with the license key. For instance your component constructor could take a licensekey parameter. You can then use the EncryptedLicenseProvider.ValidateLicenseKeyMethod to validate the key.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Mon Oct 24, 2005 3:56 am    Post subject: Reply with quote

Actually, as I understand it, the standard asp.net license model uses the design time license at run time. This is required to support the no-compile scenario. Remember that asp.net uses just-in-time compiling so there is no guarantee that the run time license will be available in the containing assembly.

Also in my case I can't explicitly set the LicenseManager.CurrentContext to design mode because I use the current context for other decision points in my code, for instance to determine if I can display a design time nag screen. What I did do was add one line to your license provider code to ensure that the license is always loaded from the design time .LIC file.

I have one more issue to solve and that is to add code to your license provider to cache the license so that the license file will only load once until the web application is restarted. This is also part of the standard asp.net license model. I assume that you don’t cache the design time license anywhere. If you did, I would be all set.

It would be nice if you had an asp.net mode where the runtime license is loaded from the .LIC file and that file is cached.

Also, with an asp.net web application, the fact that my direct customers would have to distribute my design time license key to their customers is not a serious problem. I doubt that many of my direct customer’s customers would care about using my server control at design time.

Thanks.
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Oct 24, 2005 6:18 am    Post subject: Reply with quote

Anonymous wrote:

It would be nice if you had an asp.net mode where the runtime license is loaded from the .LIC file and that file is cached.


Caching the license is generally much better handled by the component as required using a static (shared) variable eg

Code:

static License _license = null;
if (_license == null)
{
    if (!LicenseManager.IsValid(..., out license))
    {
        ...
    }
}


This leaves the component with control over whether the license will be checked each time or the cached license used.

We will look at providing a mode to force loading of the license from the file (instead of from the assembly resources)
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group