Fax ASP - Advanced Transmission with SendfaxEx2 (VB.NET fax code)

This example shows you how to send a fax from ASP using VB.NET fax code (aspx.vb), with one or more attached files, using the SendfaxEx_2 method. This method allows full control over all fax transmission aspects.

The fax ASP script requires a proxy object which can be downloaded here. To create a fresh proxy class, see instructions here.

<%@ Page Language="vb" %>
 
'
'The strFileType is a constant in this sample.
'
Dim objWS As Interfax.Interfax 'Reference to local webservice proxy connector
Dim SendFaxResult as integer
objWS = new Interfax.Interfax
Dim fs As System.IO.FileStream 'Reference to Filestream object
'
' Read data from binary file (PDF, Word, ...)
' Make sure the file exists and ASPX script has access to the file.
'
fs = IO.File.Open("C:\temp\1.pdf", IO.FileMode.Open, IO.FileAccess.Read)
'
' Allocate a byte array accoording to file length
'
Dim FilesData(fs.Length - 1) As Byte
'
' Read the entire file
'
fs.Read(FilesData, 0, fs.Length)
'
' Cleanup Stream
'
fs.Close
fs = Nothing
'
' Obtain the file type
'

objWS.SendfaxEx_2( "<Username>", "<password>", "+1 212 345 6789", "", FilesData, _
"PDF", FilesData.Length, Now, 3, "MyCSID", "", "", "Fax Subject", "myaddress@mydomain.com", _
"Letter", "Landscape", False, True)
 
objWS = Nothing
 
If SendFaxResult &gt; 0 Then
Response.Write("Fax submitted. Transaction ID: " & SendFaxResult)
Else
Response.Write("Error sending fax. Return code: " & SendFaxResult)
End If
 
%>

Read more about our fax ASP.NET simple fax transmission.