ASP.NET Fax – Submit Binary Document (C# project)

The ASP.NET fax code snippet below demonstrates usage of the SendBinaryDocument method using a C# fax API (aspx.cs extension). This example submits a binary file to the Web service, and indicates whether the submission was successful.

If the transaction ID (positive number) of the ASP.NET fax in the system is returned, this means the transaction was successful. If any other value is returned, this means the submission failed (see Web Service Return Codes for more details).

As explained above, the following snippet submits a binary file to the Web service and indicates whether the submission was successful:


{
string username = "my username";
string password = "my password";
string faxnumber = "+442079876543";
//byte[] b = System.IO.File.ReadAllBytes("c:\temp\1.pdf");
byte[] b = System.Text.Encoding.ASCII.GetBytes("This is my text");
interfax.InterFax ifws = new interfax.InterFax();
long st = ifws.Sendfax(username, password, faxnumber,b, "txt");
Response.Write("Status is " + st);
}