Licencing in VB.NET (2005)

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
UncleSyd
Posts: 19
Joined: Sun Jun 01, 2008 11:09 am

Licencing in VB.NET (2005)

Post by UncleSyd » Wed Jul 23, 2008 12:55 pm

We've just purchased a licence online and we then try and impliment it in our code but we get an odd message.... Our code is basically...

Public WithEvents objFTPConnection As New sfFTPLib.FTPConnectionSTA

Dim strKey As String = ""
strKey = strKey & "-----BEGIN KEY-----" & vbCrLf
strKey = strKey & "Product: SmartFTP FTP Library" & vbCrLf
strKey = strKey & "ID: 400060367" & vbCrLf
strKey = strKey & "User: Administrator" & vbCrLf
strKey = strKey & "Company: NAME SUPPLIED" & vbCrLf
strKey = strKey & "Email: User@ourdomain.com" & vbCrLf
strKey = strKey & "Version: 2.0" & vbCrLf
strKey = strKey & "Number of Users: 1" & vbCrLf
strKey = strKey & "Date of Issue: 2008-07-23" & vbCrLf
strKey = strKey & "Maintenance Expiration: 2009-07-23" & vbCrLf
strKey = strKey & "-----BEGIN SIGNATURE-----" & vbCrLf
strKey = strKey & "KEY REMOVED" & vbCrLf
strKey = strKey & "-----END SIGNATURE-----" & vbCrLf


Try
If objFTPConnection.LoadLicenceKeyData(strKey) Then
MsgBox("Success")
Else
MsgBox("Fail")
End If

But we get an error 'Public Member LoadLicenceKeyData on Type FTPConnectionSTAClass not found'

Put me out of my misery and tell me what I've done wrong?

Syd

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Licencing in VB.NET (2005)

Post by mb » Wed Jul 23, 2008 2:00 pm

Hello ..

It's LoadLicenseKeyData and not LoadLicenceKeyData

So s instead of a c ;-)

Regards,
Mat

UncleSyd
Posts: 19
Joined: Sun Jun 01, 2008 11:09 am

Re: Licencing in VB.NET (2005)

Post by UncleSyd » Wed Jul 23, 2008 2:06 pm

Hello ..

It's LoadLicenseKeyData and not LoadLicenceKeyData

So s instead of a c ;-)

Regards,
Mat

Mat,
We did that and still get the same error message!

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Licencing in VB.NET (2005)

Post by mb » Wed Jul 23, 2008 2:17 pm

Please post your code here. You can assume that the LoadLicenseKeyData function exists. So the problem is very likely somewhere in your code.

I also think you are using the wrong license key format. The new format is based on XML. Please take a look at the C# example.

Regards,
Mat
Last edited by mb on Wed Jul 23, 2008 2:18 pm, edited 1 time in total.

UncleSyd
Posts: 19
Joined: Sun Jun 01, 2008 11:09 am

Re: Licencing in VB.NET (2005)

Post by UncleSyd » Wed Jul 23, 2008 2:27 pm

Please post your code here. You can assume that the LoadLicenseKeyData function exists. So the problem is very likely somewhere in your code.

I also think you are using the wrong license key format. The new format is based on XML. Please take a look at the C# example.

Regards,
Mat

dim objFTPConenction = new sfFTPLib.FTPConnectionSTA

Dim strKey As String = ""
strKey = "<License><Version>2.0</Version><Id>400060367</Id><Name>Administrator</Name><Email>anthony.coker@nsureexpress.com</Email><Company>oolio online limited</Company><Product>SmartFTP FTP Library</Product><Features><Feature>FTP</Feature></Features><Users>1</Users><Maintenance>2009-07-23</Maintenance><Issue>2008-07-23</Issue><Signature>ilR07MgVhn5GHMIgKmthox5rsclEfIc69ohtWRphYxnC0hQsrf1UyZFSkerFmRB1EoJZrrdvZkT/6UDgXiWIWIsSzYJZH4siWJZpZIE4UpkHXw1ULYve09tyDnw8EMZvXoNWkJLGzyWhKEHompatA5hDQqKD
Gk+FQZoP9w3bOBuIqZ7oq/bCnoDFRiKkPbON6pd5//z/xOdeAOkxmTPuama7ZqYlq5FLNYt3xH49wkgmYBjUQukQ==</Signature></License>"


Try
If Not objftpConnection.LoadLicenseKeyData(strKey) Then
GenericServices.MessageBoxCriticalOKOnly(My.Resources.LicenceKeyFailure)
Application.Exit()
End If

objFTPConnection.Host = objSettings.Server.ToString
objFTPConnection.Port = 21
objFTPConnection.Username = objSettings.Username.ToString
objFTPConnection.Password = objSettings.Password.ToString & A1012
objFTPConnection.Protocol = enumProtocol.ftpProtocolSSLExplicit
objFTPConnection.Proxy.Type = enumProxyType.ftpProxyTypeNone
objFTPConnection.Client = System.Environment.MachineName
objFTPConnection.LogFile = ""
objFTPConnection.DataTransferMode = enumDataTransferMode.ftpDataTransferModeZ
objFTPConnection.Async = False
objFTPConnection.LISTOption = enumLISTOption.ftpLISTOptionLong
objFTPConnection.TransferProgressEventInterval = 1000
objFTPConnection.DataProtection = enumDataProtection.ftpDataProtectionPrivate
objFTPConnection.Timeout = 60

AddHandler objFTPConnection.OnTransferProgress, AddressOf OnTransferProgress

Select Case objFTPConnection.Connect()
Last edited by UncleSyd on Wed Jul 23, 2008 2:49 pm, edited 1 time in total.

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Licencing in VB.NET (2005)

Post by mb » Wed Jul 23, 2008 2:48 pm

The FTPConnection interface has no LoadLicenseKeyData method. You have to use the Global interface for that.

Also your strKey is still wrong. You forgot to add the following part:
strKey = strKey & "<?xml version=\""1.0\"" ?>" & Chr(13) & Chr(10)

Why don't use the VB.NET sample which is included in our product?

Regards,
Mat
Last edited by mb on Wed Jul 23, 2008 2:51 pm, edited 1 time in total.

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: Licencing in VB.NET (2005)

Post by mb » Wed Jul 23, 2008 2:54 pm

Code: Select all

		Dim objGlobal As sfFTPLib.[Global]

		'objGlobal = CreateObject("sfFTPLib.Global")

		objGlobal = New sfFTPLib.[Global]

		

				Dim strKey As String

				

'				strKey = strKey & "-----BEGIN KEY-----" & Chr(13) & Chr(10)

'				strKey = strKey & "Product: SmartFTP FTP Library" & Chr(13) & Chr(10)

'				strKey = strKey & "ID: 400000000" & Chr(13) & Chr(10)

'				strKey = strKey & "User: user" & Chr(13) & Chr(10)

'				strKey = strKey & "Company: my company" & Chr(13) & Chr(10)

'				strKey = strKey & "Email: user@host.com" & Chr(13) & Chr(10)

'				strKey = strKey & "Version: 1.0" & Chr(13) & Chr(10)

'				strKey = strKey & "Number of Users: 1" & Chr(13) & Chr(10)

'				strKey = strKey & "Date of Issue: 2005-04-05" & Chr(13) & Chr(10)

'				strKey = strKey & "Maintenance Expiration: 2006-04-05" & Chr(13) & Chr(10)

'				strKey = strKey & "-----BEGIN SIGNATURE-----" & Chr(13) & Chr(10)

'				strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & Chr(13) & Chr(10)

'				strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & Chr(13) & Chr(10)

'				strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & Chr(13) & Chr(10)

'				strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" & Chr(13) & Chr(10)

'				strKey = strKey & "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==" & Chr(13) & Chr(10)

'				strKey = strKey & "-----END SIGNATURE-----" & Chr(13) & Chr(10)	



		' New license key format

		strKey = ""

		strKey = strKey & "<?xml version=\""1.0\"" ?>" & Chr(13) & Chr(10)

		strKey = strKey & "<License>" & Chr(13) & Chr(10)

		strKey = strKey & "<Version>2.0</Version>" & Chr(13) & Chr(10)

		strKey = strKey & "<Id>400012345</Id>" & Chr(13) & Chr(10)

		strKey = strKey & "<Name>name</Name>" & Chr(13) & Chr(10)

		strKey = strKey & "<Email>user@host.com</Email>" & Chr(13) & Chr(10)

		strKey = strKey & "<Company>company</Company>" & Chr(13) & Chr(10)

		strKey = strKey & "<Product>SmartFTP FTP Library</Product>" & Chr(13) & Chr(10)

		strKey = strKey & "<Features>" & Chr(13) & Chr(10)

		strKey = strKey & "<Feature>SFTP</Feature>" & Chr(13) & Chr(10)

		strKey = strKey & "</Features>" & Chr(13) & Chr(10)

		strKey = strKey & "<Users>1</Users>" & Chr(13) & Chr(10)

		strKey = strKey & "<Maintenance>2008-12-27</Maintenance>" & Chr(13) & Chr(10)

		strKey = strKey & "<Issue>2007-12-27</Issue>" & Chr(13) & Chr(10)

		strKey = strKey & "<Signature>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</Signature>" & Chr(13) & Chr(10)

		strKey = strKey & "</License>" & Chr(13) & Chr(10)





		' Load License Key

		If objGlobal.LoadLicenseKeyData(strKey) Then

			System.Console.WriteLine("License key verified.")

		Else

			System.Console.WriteLine("Failed to verify license key.")

		End If

UncleSyd
Posts: 19
Joined: Sun Jun 01, 2008 11:09 am

Re: Licencing in VB.NET (2005)

Post by UncleSyd » Wed Jul 23, 2008 3:10 pm


Post Reply