Jump to content


Photo

Licencing in VB.NET (2005)


  • Please log in to reply
7 replies to this topic

#1 UncleSyd

UncleSyd
  • Members
  • 19 posts
  • Location:
    Wales

Posted 23 July 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

#2 mb

mb

    Developer

  • Administrators
  • 11526 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 23 July 2008 - 02:00 PM

Hello ..

It's LoadLicenseKeyData and not LoadLicenceKeyData

So s instead of a c ;-)

Regards,
Mat

#3 UncleSyd

UncleSyd
  • Members
  • 19 posts
  • Location:
    Wales

Posted 23 July 2008 - 02: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!

#4 mb

mb

    Developer

  • Administrators
  • 11526 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 23 July 2008 - 02: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

#5 UncleSyd

UncleSyd
  • Members
  • 19 posts
  • Location:
    Wales

Posted 23 July 2008 - 02: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()

#6 mb

mb

    Developer

  • Administrators
  • 11526 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 23 July 2008 - 02: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

#7 mb

mb

    Developer

  • Administrators
  • 11526 posts
  • Gender:
    Male
  • Location:
    Worldwide

Posted 23 July 2008 - 02:54 PM

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


#8 UncleSyd

UncleSyd
  • Members
  • 19 posts
  • Location:
    Wales

Posted 23 July 2008 - 03:10 PM

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


Mat,

thanks fixed. I was being an idiot

Syd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users