Licensing for ASP.NET

balancebalance Posts: 11
edited November 17, 2006 4:08AM in SQL Toolkit Previous Versions
I am trying to get my SQL Toolkit to work in an ASP.NET 2.0 application and am having some big issues with licensing.

When I compile and run my application locally, I have no problem, but when I copy it to a production server, I get the dreaded "modal dialog box" error.

I have done all of my RedGate work in an external .dll which I have compiled with a licx file, but no matter what I do, I cannot get it to prompt for my serial number or generate a .lic file to use in my application. Any suggestions?

Comments

  • I too am experiencing this. I have followed the instructions in the help guide for distributing applications but have not been successful. Please let me know what the solution to this is!
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    I don't have the definitive answer based on the information provided, but I can make some suggestions:
    • Check that licenses.licx is part of the project. In case #1 the library project in the solution
    • Check licenses.licx properties to make sure it is compiled as Embedded Resource
    • If there are still problems, remove licenses.licx and re-create it
    The application works in case #1 because a Toolkit application had been previously licensed and the application had detected the existing 'SQL Toolkit_v5.lic' on the local machine. Deploy the application to another machine and the application runs unlicensed, which in the case of a web application, causes the nag requester to come up. The nag requester is a Windows Form and can't be displayed in a web application.

    In case #2, if the application is a web application written in VS 2005, then the error may be happening because the web application is dynamically compiled, making it nigh on impossible to licence (You would need to produce a 'SQL Toolkit_v5.lic' on the server and copy it to the project directory). The best way around this is the solution from case #1, which is to move your Toolkit code out of the web application and into an external class file that you reference from the web application code.

    Hopefuly this helps you!
  • I'm using VS2005 to create a web application and have added the required redgate lines (after 6 lines of infragistics components) to the licenses.licx file. I do not see anywhere in the properties of this file where I can make it part of the embedded resources. Since this project type doesn't really compile, I assume this is why I don't see the embedded resource option.

    I've tried a few times deleting and re-creating the licenses.licx file and still nothing.

    Do I need to create a class file and compile it into a dll in order to generate the required toolkit_v5.lic file and then reference that dll in my web project?

    Also, am I correct in assuming that I need to move that 'SQL Toolkit_v5.lic' file to the production server (after I successfully create it)? I was under the impression that we were NOT to distibute .lic files as stated at the bottom of the help file for distributing applications. Could you please clarify?

    Thanks!
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,

    Just to clear this up... The licensing works like this: The licenses.licx file invokes Microsoft's lc.exe (licence compiler). LC looks at the class you are licensing (RedGate.SQLCompare.Engine.Database) and this tells LC that a custom licensing component is required (RedGate.Licensing.Client.dll). The component throws up the serial number request, activates the product, and cretaes a licence (.lic) file. This licence file is specific to the machine it was licensed on, so it does absolutely no good to copy this to another machine!

    Once the lic file is created, the licensing client 'embeds' the licence information into the assembly. This allows the assembly to be deployed without the need for activation.

    Now, if the .lic file is created already, and you build the project, the licensing client will silently embed the existing .lic file if it is valid, ie it will potentially not prompt you for a serial number every time. This is how you can licence web applications, by compiling a console project to get the .lic, copy the lic to your web application directory and then build to get around the issue of having no support for modal dialogues.

    This method doesn't work any more on VS 2005 because it insists the web application be compiled dynamically. The two ways around that I mentioned previously are to create a .lic file on the web server by compiling a console application on the server and copying the .lic file in with the web app code. This is not ideal because it will add additional compile time, so creating an external dll with just the Toolkit functionality in it is a better solution because the licence compiling is a one-time deal.
  • Yes, this is my same scenario. I am using ASP.NET 2.0 (dynamic compilation), but I am already using Red Gate in an external .dll. When I compile the .dll with a .licx file, however, the system does not prompt me for a serial number... I've removed and replaced the licenses.licx file numerous times without any success. Again, any suggestions?
  • Ok, I've got it figured out (I think!)

    Here's what I did:

    I opened an instance of VS2003 and opened the solution that came provided with the red gate software (C:\Program Files\Red Gate\SQL Bundle 5\Toolkit Sample Files\Automating SQL Data Compare\C#). Don't worry about changing the database names in the files, you won't need to.

    I compiled this solution as is and copied the compiled application with supporting dlls onto the live server.

    I logged onto the live server and executed the application. It prompted me to activate, I entered my serial number and it said activation successful. The application then bombed out on me since I didn't have the required database names on that server, but I just closed the application.

    Do a search on your server for the file "SQL Toolkit_v5_0.lic". I found mine in "C:\Documents and Settings\All Users\Application Data\Red Gate\Licenses".

    Now copy this file to your web folder (not sure if it needs to be in the root or the bin folder, I put it in both).

    Web application should work fine! Hoo-ray!
  • I just don't get it....

    I followed EXACTLY the steps you've noted, but when I run the executable on the server, I don't get a popup at all - and my search for the .lic file returns nothing. I really need to get this working - any OTHER ideas? :P
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Okay...

    If you're compiling the dll project and aren't getting a popup, and you don't have a 'SQL Toolkit_v5.lic' (assuming you have v5 of Toolkit), then there is still something wrong with licenses.licx where Visual Studio isn't picking it up.

    Maybe it's best to start over. Delete licenses.licx from the project. Then right-click the project and add->new item, Text File, call it licenses.licx, the contents should be
    RedGate.SQLCompare.Engine.Database, RedGate.SQLCompare.Engine<return>
    . Save the file.
    In the VS object explorer, right-click licenses.licx and select properties. Make sure that under Build Action in the properties, this says Embedded Resource. Build the project. You should be asked for a serial number to activate SQL Toolkit.
  • Just deleted it, recreated it (the license file), recompiled, copied to server, ran it - and still no popup
  • OK just had a quick look at this myself to make sure I'm not going mad, with the toolkit there are some sample files and these are stored in...

    C:\Program Files\Red Gate\SQL Bundle 5\Toolkit Sample Files\Automating SQL Data Compare\C#

    Use these to make sure you can compile and license the toolkit samples to start with.

    Your own project should have a reference to all of...
    RedGate.SQL.Shared.dll
    RedGate.SQLCompare.Engine.dll
    RedGate.SQLDataCompare.Engine.dll (If you're using it)

    Also in your reference path should be...
    RedGate.Licensing.Client.dll
    RedGate.Licensing.Helper.dll
    ...as these are needed to actually perform the licensing and embed the resource.

    Make sure your project can find the dlls by putting them in the reference path.

    Like Brian was saying there is no need to move the .lic file around with your .exe as it will be embedded as a resource. If you have already licensed your version of the toolkit (i.e. you have the .lic file in your all users folder you won't get asked to activate your license ).

    Finally the licenses.licx file should look like...
    RedGate.SQLCompare.Engine.Database, Redgate.SQLCompare.Engine
    RedGate.SQLDataCompare.Engine.ComparisonSession, RedGate.SQLDataCompare.Engine
    Richard Mitchell
    Project Manager
    Red Gate Software Ltd
  • Yes, this is all true, and this is my EXACT setup. The problem is that I cannot get Red Gate Toolkit to work on a web server! Even though I do not get asked to license the file locally, I am when I try to run a web page that contains a .dll which uses the Red Gate Toolkit

    Would it not be possible to send me a executable that I could run on the server that would prompt me for my code and generate a license?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi Ryan,

    I have sent you a stand alone application that will at least produce the required licence file. Hopefully you will find this useful.
  • Could this be related to the compile options of the website. I've never tried running it in that scenario so I'm unsure how you would ever be able to license applications. Perhaps it's worth activating the license on your webserver so that when the application comes to run and compile it can find the license and there are no problems. You would probably need the Licensing Client and Helper dlls available to the application too.

    If you're compiling to a .dll stored in a bin/ directory of the website I'm not sure why it wouldn't work as you've got it setup. If you're using an App_Code/ directory or other runtime compilation setup I can envisage whole worlds of pain.

    The other thing of course is to create a wrapper dll that uses the red gate API and creates a small subset of the API that you need on your website this can then be pre-compiled and put onto your website and used by your website code.

    I'd be interested to know which setup you have for your web app.
    Richard Mitchell
    Project Manager
    Red Gate Software Ltd
Sign In or Register to comment.