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 

Little help

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





PostPosted: Sun Sep 11, 2005 12:58 am    Post subject: Little help Reply with quote

Hello,
I have an assembly that is going to be used as a DAL in a web app. I'm trying to license it with the eval of ILS. Here's what I have done so far.

1. Added a reference to Infralution.Licensing to my project
2. Used the License Tracker to Create a product and generate some keys
3. Added the Following code:
Code:

Imports System.ComponentModel
Imports Infralution.Licensing
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient


and the following:
Code:

<LicenseProvider(GetType(Infralution.Licensing.EncryptedLicenseProvider))> _
Public Class LocatorHandler
    Inherits Component
    Const _licenseParameters As String = _
        "<LicenseParameters>" & _
        "       <RSAKeyValue>" & _
        "       <Modulus>vQRLe3sbmqM2mOjRjFVZfM5mQ/mUj/HDbuFWB9P6ho924OOKzY8B9QoU9YfR4w52jQkZKs2jefYUz1J2vjbMYlfTrYMKfAHWsfY2bTQ5OKvDRcyFSNekZea2xuRCPZ1Pd+9ts+jenkVsQ6PcBsdaTT75PRhl/iWtN8CdpY8uj+8=</Modulus>" & _
        "       <Exponent>AQAB</Exponent>" & _
        "       </RSAKeyValue>" & _
        "       <DesignSignature>SdfXpFsZuJLtRa7iWE4bGyBAiNhuAJWnvUGgfSgAl85ASjFwcI7AwzyDkVspplR1AsBlglSVJjyFdk/j/mPWjo13Mq6Driu5nxqGRGXogp+BCgk2x4YRDqqT7Sgs/pYXglEg8/T7UZt7zXwPZXfEu8NFaD5bG0oxCuuuWf0hf7g=</DesignSignature>" & _
        "       <RuntimeSignature>cs/jdkLXsbXBoA8HDvoMtMQRhaYXYb/XQ4NGYJoIz/jGGYQHExuKplFjVc1Vfz3ZdIwf6WqxJjw07DT3IVclCZmf5w+NRYA4+2Q061k7ops9oUGZvAWqptcWOheMKio45rgUqiA8YEbfH56PwI42RZk2n0k0O3m2o/5Z2jcfwqA=</RuntimeSignature>" & _
        "</LicenseParameters>"


and:
Code:

Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        EncryptedLicenseProvider.SetParameters(_licenseParameters)
        If Not LicenseManager.IsLicensed(GetType(LocatorHandler)) Then
            If LicenseManager.CurrentContext.UsageMode = LicenseUsageMode.Runtime Then
            Else
            End If
        End If
    End Sub


Since this is going to be used in a web app how do I send a notice back to the ASP.NET page if the DLL is not a licensed version?
Back to top
mpreuett
Guest





PostPosted: Sun Sep 11, 2005 1:01 am    Post subject: Additional info Reply with quote

Currently all this does is run the application as if it was licensed.
Back to top
mpreuett
Guest





PostPosted: Sun Sep 11, 2005 1:25 am    Post subject: A little farther Reply with quote

Modified the code to:
Code:

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        EncryptedLicenseProvider.SetParameters(_licenseParameters)
        If Not LicenseManager.IsLicensed(GetType(LocatorHandler)) Then
            Throw New LicenseException(GetType(LocatorHandler))
        End If
    End Sub


This gave me the licensing error. When I put the license key in the .lic file everything worked fine. Now my question is how do I redirect to a different page at that point to allow someone to purchase?

Thanks in advance,
Mike Preuett
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Sep 11, 2005 11:21 pm    Post subject: Reply with quote

You can alternatively use the LicenseManager.Validate call which will throw the LicenseException for you if there is no installed license eg

Code:

Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        EncryptedLicenseProvider.SetParameters(_licenseParameters)
        LicenseManager.Validate(GetType(LocatorHandler))
End Sub


If your product is a DLL then I don't think it will be possible to redirect the client ASP app to a different page - but someone with more ASP knowledge may be able to confirm that. It might be possible to display a popup (assuming the user isn't blocking them). It also depends on whether your DLL is an ASP control or a component. If it is a control you could change the output to indicate it wasn't licensed. If it is a component you are probably stuck with throwing an exception.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
mpreuett



Joined: 12 Sep 2005
Posts: 7

PostPosted: Mon Sep 12, 2005 3:25 am    Post subject: Little help #2 Reply with quote

Ok, have most everything figured out. I've moved everything into my asp.net app and am not creating the component separately. I can't seem to get it to recognize a license. I've created a distributor, product, and a key in the tracker. I've put the encryptedlicense, enctyptedlicenseprovider, and the evaluationmonitor.vb files in my solution. In the default.aspx page i added:
Code:
<LicenseProvider(GetType(EncryptedLicenseProvider))> _
to the top of the _default class, and the following in the page_load:
Code:
Const _licenseparameters As String = _
        "<LicenseParameters>" & _
        "   <RSAKeyValue>" & _
        "       <Modulus>zdOFOnU8z9Z0NQKNO8HuGq0s33eRIElgYEHMSotmxqbs1QyniCjyV+FnjvbYBrLHtueZ7N9AlAOUI5liiBtOwdKePXJTWxFgyQXRPbUd/Zz/O9dnd3mj80H/iK6HKPF2O/e7GV8dWpgScjF7R4NQxmpT5mKrdVIbVDeG5USLXN8=</Modulus>" & _
        "           <Exponent>AQAB</Exponent>" & _
        "   </RSAKeyValue>" & _
        "   <DesignSignature>R0Cjo25BKWwszeUw59KdgfOB5OhuarZdiukXv9r5jlBwTZpkVjlj3ipH/ahDToc2e+KVXle0AFUxzK+CN/W6IcRxNe56Uvt+r60k1zbCL3kVMtPJ8LCbIuy32u/NULJWGbf1FHXnDGzXwgoMrJrugZEvZRwnyFji8JyNp6MKjUs=</DesignSignature>" & _
        "   <RuntimeSignature>BJw8IZNHtXFgTDSiKbJbibJnapktn3t4c7uBYR5NRGnF/iUpEhzXXwk7lfje4Wae9E9R3QeTEyzUdg1I4qFtbamiWnQxcM7s8ulNQrUyxI/0pbQJXpIM4bitBW+t3Kx7/rSZYiIHmCJf2NOxL6iPtloQ7qw3LWaNf2UW5Lbxlu8=</RuntimeSignature>" & _
        "</LicenseParameters>"
        EncryptedLicenseProvider.SetParameters(_licenseparameters)
        If Not LicenseManager.IsLicensed(GetType(_default)) Then
            Throw New LicenseException(GetType(_default))
        Else

        End If

And created a .lic file named PDCLocator._default.lic and placed in the bin folder and placed the license key that i generated in it.

I can't seem to get the app to validate the license. Any suggestions?

Thanks in advance,
Mike
Back to top
View user's profile Send private message Yahoo Messenger
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Sep 12, 2005 3:42 am    Post subject: Reply with quote

Are you trying to license an ASP app now or your DLL?

If you are trying to install a license for your DLL in an ASP app that uses it then you create a file with name "Namespace.TypeName.lic". In your case from what I can gather TypeName = "LocatorHandler". But I'm not sure what your namespace is. If you are using VB then by default it is the name of your project. I thought from your earlier post that you had successfully installed a license file?

If you are still having issues then run the project in the debugger and place a breakpoint in EncryptedLicenseProvider.ReadKeyFromFile and see what the name and path to the license file should be.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
mpreuett



Joined: 12 Sep 2005
Posts: 7

PostPosted: Mon Sep 12, 2005 3:58 am    Post subject: Reply with quote

ASP app. I've moved everything into my asp app versus a separate DLL. Here's what I get at the breakpoint "c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\pdclocator\5b64f2f2\59db8b07\assembly\dl2\4479d841\76fc1916_4db7c501\PDCLocator._default.lic"
Back to top
View user's profile Send private message Yahoo Messenger
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Sep 12, 2005 10:00 am    Post subject: Reply with quote

The problem is the path where it is looking for the license file. This should be typically something like C:\inetpub\wwwroot\myproject\bin.

I've double checked the latest release with ASP on our test machine and it resolves the correct directory OK - although this was a problem with some earlier releases. Trace into the code in GetLicenseDirectory. This should look something like:

Code:
       
        protected virtual string GetLicenseDirectory(LicenseContext context, Type type)
        {
            string result = null;

            // try to use the type resolver service if available
            //
            if (context != null)
            {
                ITypeResolutionService resolver = (ITypeResolutionService)context.GetService(typeof(ITypeResolutionService));
                if (resolver != null)
                    result = resolver.GetPathOfAssembly(type.Assembly.GetName());
            }
       
            if (result == null)
            {
                // use the code base if possible - because this works properly under ASP.NET
                // where as the Module.FullyQualifiedName points to a temporary file
                //
                result = type.Assembly.CodeBase;
                if (result.StartsWith(@"file:///"))
                {
                    result = result.Replace(@"file:///", "");
                }
                else
                {
                    result = type.Module.FullyQualifiedName;
                }
            }
            return Path.GetDirectoryName(result);
        }


For ASP applications it should be getting the path from the assembly code base - but for some reason on your system this is not happening.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
mpreuett



Joined: 12 Sep 2005
Posts: 7

PostPosted: Mon Sep 12, 2005 5:16 pm    Post subject: Reply with quote

I'll try creating a project on a different box and see what happens. I thought it was strange that it was hitting a temp folder for the license.
Back to top
View user's profile Send private message Yahoo Messenger
mpreuett



Joined: 12 Sep 2005
Posts: 7

PostPosted: Tue Sep 13, 2005 3:46 pm    Post subject: Little Help - Solved Reply with quote

Thanks for the excellent support on this. The edited file worked perfectly. Problem solved.

Mike
Back to top
View user's profile Send private message Yahoo Messenger
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