Login  
Search All Forums
Dart Home | PowerTCP Web for ActiveX | Custom Development Reply | PowerTCP Web for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web for ActiveX
Topic: License problems when distributing
rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 6:12 AM

We've bought a development license for the Webtool and finished our application during testing of this we installed on several maschines different from the deveolpment environment. We get a "component not licensed for this machine" on those computers. What can be done to solve this problem?
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 8:55 AM

Please describe your application. Is it a Windows Form app? A web page? How is the Http control created?
rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 9:05 AM

It's a Windows form application. We use the HttpClass which is generated when needed.

The application is written in C#
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 9:10 AM

Since your are using C#, you have to implement licensing yourself. Please review the following thread:

http://support.dart.com/postings?topicid=2647

rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 9:29 AM

After translating it to c# I still have a problem,
When using the httpclass instead of the zip class I get an ArgumentException:
Additional information: Object type cannot be converted to target type.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 9:51 AM

You can't use the "class" approach. As the posting explains, you need to use the "Ax" type of control.

Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 10:00 AM

As a test, I just did the following and it worked fine (You have to use your own serial number if you do it):

  Private Const SERIAL_NUMBER = "1570-1-x-xxxxxx"
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Button1.Enabled = False
    Dim Http1 As New AxDartWeb.AxHttp()
    Dim fieldInfo As System.Reflection.FieldInfo
    fieldInfo = GetType(System.Windows.Forms.AxHost).GetField("licenseKey", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
    fieldInfo.SetValue(Http1, SERIAL_NUMBER)
    Http1.CreateControl()
    Http1.Url = "http://www.dart.com"
    Dim s As String = ""
    Http1.Get(s)
    MsgBox(s)
    Button1.Enabled = True
  End Sub

rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 10:13 AM

OK thankx for the example I have one final question (I hope/think) which file do I need to reference to get access to the AxDartWeb.AxHttp class? the only class in DartWeb is HttpClass (that was why I originally ignored the Ax approach) I Don't have a AxDartWeb.dll which was what I was looking for

thanx again
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 10:17 AM


As explained in the posting, you get AxDartWeb by inserting a control onto a form (which you can later delete)

Also here is the C# equivalent of my previous code:

private void button1_Click(object sender, System.EventArgs e)
{
string SERIAL_NUMBER = "1570-1-x-xxxxxx";
button1.Enabled = false;
AxDartWeb.AxHttp Http1 = new AxDartWeb.AxHttp();
System.Reflection.FieldInfo fieldInfo = typeof(System.Windows.Forms.AxHost).GetField("licenseKey", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
  fieldInfo.SetValue(Http1, SERIAL_NUMBER);
Http1.CreateControl();
Http1.Url = "http://www.dart.com";
object s = "";
Http1.Get(ref s);
MessageBox.Show(s.ToString());
button1.Enabled = true;
}
rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 10:51 AM

So far so good,
I've gotten the license code working thanx to your help but I now have a different problem.
I get:
"Could not instantiate ActiveX control 'c8b8bac2-9451-11d2-ba66-0040053687fe' because the current thread is not in a single-threaded apartment."

When I try to run:
public static AxDartWeb.AxHttp CreateHttp()
{
try
{
AxDartWeb.AxHttp Http = new AxDartWeb.AxHttp();
string SERIAL_NUMBER = "1570-1-1225-758922";
System.Reflection.FieldInfo fieldInfo = typeof(System.Windows.Forms.AxHost).GetField("licenseKey", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
fieldInfo.SetValue(Http, SERIAL_NUMBER);
return Http;
}
catch (Exception e)
{
throw e; //return null;
}
}
in a multithreaded environment. It's very imponrtant for our application to use multithreading so changing to single threaded is not an option (the application is communicating with up to 8000 severs in parallel so doing it serial is really no option :-)) Do you have a work around for this problem. It's not a problem with the httpclass only with AxHttp
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 10:55 AM

It may have something to do with the fact that the Http control use WININET.DLL but I am not sure.

If you are worried about blocking then you could start using the Http control in asynchronous mode, where Timeout = 0 and you use the events to determine when something is done.
rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 5, 2004 11:51 AM

Am not worried about blocking i'm worried about the fact that I don't get any longer than this line:
AxDartWeb.AxHttp Http = new AxDartWeb.AxHttp();

it fails with a message complaining about the multithreaded environment
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 5, 2004 12:02 PM

Since I don't know that solution, I was recommending a workaround. I have read about threading problems with WININET.DLL before so I assume that this problem has to do with that and you likely won't be able to use the Web control in such a complex manner.

We also have the WebEnterprise tool that includes the WebASP control (which we wrote because people did not want to be dependent on WININET) so you may want to try that.

Also, depending on the complexity of your web requests, you may just want to use our Sockets for .NET and do the requests manually using the Tcp component.
rune@vrk.dk

From: Copenhagen, Denmark
Posts: 7
Member Since: 11/05/04
posted November 7, 2004 8:57 AM

It can't be a problem with wininet (not directly at least). I've developed and tested the application with your control and it's working on the development maschine (where the developer licens is registred). The problem described only arises when I try the license work around you gave me
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted November 8, 2004 9:45 AM

It looks like this issue is going to be too complicated to solve on the forum. Please email support@dart.com and go through the normal support channels.

Reply | PowerTCP Web for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX