ASP.NET Fax – Submit Binary Document (VB.NET code)

25 Nov 2016 This code sample is deprecated and in process of being removed. Check out our new code libraries and usage documentation on InterFAX @ Github.

This code sample demonstrates how to submit a binary ASP.NET fax, using VB.NET (.aspx.vb extension). This is done using the SendBinaryDocument method.

The SendBinaryDocument method also indicates whether your submission was successful by returning the transaction ID (positive number) of the fax in the system. If any other value is returned, the submission failed (see Web Service Return Codes for more details).

The following snippet sends an ASP.NET fax in binary format using VB.NET (aspx.vb), and indicates whether the submission was successful:

Dim username As String = "my username"
        Dim password As String = "my password"
        Dim faxnumber As String = "+442079876543"
        'dim b as byte() = System.IO.File.ReadAllBytes("c:\temp\1.pdf")
        Dim b As Byte() = System.Text.Encoding.ASCII.GetBytes("This is my text")
        Dim ifws As New interfax.InterFax()
        Dim st As Long = ifws.Sendfax(username, password, faxnumber, b, "txt")
        Response.Write("Status is " & st)
    End Sub

End Class