Can I use the VB.NET SDK from behind a local proxy server?

Help with the Esendex SDK

Can I use the VB.NET SDK from behind a local proxy server?

Postby Jonathan » Tue Mar 16, 2010 4:46 am

The VB.NET SDK uses a Web Reference to access our SOAP API.
If your computer is behind a local Proxy server then you will need to give the SendService details of your proxy.
Here is the Module1.vb code amended for a Proxy Server. You will need to supply your own values for your Proxy Address, Proxy Username and Proxy Password in the following code:

Module Module1

Sub Main()

Dim Username As String
Dim Password As String
Dim Account As String
Dim Recipient As String
Dim Body As String

Username = "" 'set username here
Password = "" 'set password here
Account = "" 'set account reference here
Recipient = "" 'set recipient here
Body = "Hello World from VB.NET"

Dim header As esendex.MessengerHeader

header = New esendex.MessengerHeader
header.Username = Username
header.Password = Password
header.Account = Account

Dim service As esendex.SendService

Dim credentials As Net.NetworkCredential
credentials = New Net.NetworkCredential("username", "password")

Dim bypassOnLocal As Boolean
bypassOnLocal = True

Dim bypassList As Array

Dim proxy As Net.WebProxy
proxy = New Net.WebProxy("proxyaddress", True, bypassList, credentials)

service = New esendex.SendService
service.MessengerHeaderValue = header
service.Proxy = proxy
service.SendMessage(Recipient, Body, esendex.MessageType.Text)

End Sub

End Module


N.B.: The above code is for illustration only and is not endorsed as suitable for live production use.
Jonathan
 
Posts: 7
Joined: Thu Mar 04, 2010 5:48 pm

Return to SDK



cron
© Esendex Ltd 2010
Company Registration Number: 04217280