LicenseProvider / LicenseContext question

R

rino

Hi
In my implementation of LicenseProvider.GetLicense
I noticed that if I dont have a license in my exe file and I call
context.GetSavedLicenseKey(type, null);
it will fail. .... So Far so good

HOWEVER I see that if before hand I called the method with an assembly that
does contain an license
context.GetSavedLicenseKey(type, DllContainigLicenseAssembly);

and after that I once again call GetSavedLicenseKey(type,null)
This time it will return a key .
Any idea why this happens. Its as if the key is cached somewhere .
 
L

Linda Liu[MSFT]

Hi,

Since you implement a custom LicenseProvider, it would be better if you
could send me a sample project that could reproduce the problem. My email
address is (e-mail address removed).

I look forward to your reply!

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Linda Liu[MSFT]

Hi Ryan,

Thank you for your sample project and detailed explanation! I understand
your question now.

I performed a test on your sample project and did see the problem you
described, i.e. if the context.GetSavedLicenseKey method has retrieved a
valid license key for a particular component type previously, it will
return a license key for this particular component type even if the
specified assembly this time doesn't contain a license key at all.

When the application is run, the context parameter passed to the GetLicense
method is actually of type RuntimeLicenseContext. I look into the
GetSavedLicenseKey method of the RuntimeLicenseContext class using
Reflector and have the following findings:

The RuntimeLicenseContext.GetSavedLicenseKey method really uses an internal
hashtable. If the hashtable contains a license key for the specified
component type, it simply returns this license key without retrieving from
actually specified assembly. Otherwise, it retrieves the license key from
the specified assembly. If succeed, it stores the license key to the
internal hashtable.

So this behavior is by design.

If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
R

rino

Hi Linda
Thanks very much for your complete explaination. Its clear to me now .
Maybe it would be nice if this be documented in the MSDN library .
Thanks
 
L

Linda Liu[MSFT]

Hi Ryan,

Thank you for your quick response!

Yes, I also think so. But the RuntimeLicenseContext class isn't exposed to
developers, so we can't look up the RuntimeLicenseContext class and its
members in MSDN documents.

Remember that Reflector is always a good assistant in this case.

If you have any other questions in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance.

Have a nice day!

Sincerely,
Linda Liu
Microsoft Online Community Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top