ASP.NET Fax – Setting up your C# environment

In this section, you create, compile and reference the proxy class in order to set up a C# environment to work with the InterFAX Web service and send ASP.NET faxes with C#.

For more general information, see ASP.NET Fax – Setting Up Your Environment.

If you are working with VB.NET, learn how to set up your VB.NET Environment, or see the VB fax (VB.NET) examples. Alternatively, see additional C# or ASP (ASPX and ASP classic) examples.

ASP.NET Fax – Creating proxy class with .NET SDK

The following creates source code for the proxy class in C# (.cs). Note that the wsdl.exe utility is typically located under C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\.

To send ASP.NET faxes with C# (outbound service):

Copy
Wsdl.exe https://ws.interfax.net/dfs.asmx?WSDL /l:cs  /n:InterfaxOut /out:c:\temp\Interfax\Out.cs

The input above creates a source file name Out.cs.

To receive faxes (inbound service):

Copy
Wsdl.exe https://ws.interfax.net/inbound.asmx?WSDL /l:cs  /n:InterfaxIn /out:c:\temp\Interfax\In.cs

The input above creates a source file named In.cs.

For administration services (administrating accounts):

Copy
Wsdl.exe https://ws.interfax.net/admin.asmx?WSDL /l:cs  /n:InterfaxAdmin /out:c:\temp\Interfax\Admin.cs

The input above creates a source file named Admin.cs.

Compiling Proxy Class

You should use the CS.NET compiler (csc.exe) which is located under C:\WINDOWS\Microsoft.NET\Framework\.

For outbound services (sending ASP.NET faxes with C#):

Copy
Csc.exe /out:InterfaxOut.dll /target:library /reference:System.dll  /reference:System.Web.dll  /reference:System.Web.Services.dll  /reference:System.Xml.dll  c:\temp\Interfax\Out.cs

The input above creates a file named InterfaxOut.dll.

For inbound services (receiving faxes):

Copy
Csc.exe /out:InterfaxIn.dll /target:library /reference:System.dll  /reference:System.Web.dll  /reference:System.Web.Services.dll  /reference:System.Xml.dll c:\temp\Interfax\In.cs

The input above creates a file named InterfaxIn.dll.

For administration services (receiving faxes):

Copy
Csc.exe /out:InterfaxAdmin.dll /target:library /reference:System.dll  /reference:System.Web.dll  /reference:System.Web.Services.dll  /reference:System.Xml.dll c:\temp\Interfax\Admin.cs

The input above creates a file named InterfaxAdmin.dll.

Copy the desired assembly DLL file or files to the C:\temp\interfax\bin folder.

Referencing proxy class

Simply add a reference to your code pointing to the required classes within the proxy class. Example (for inbound):

Copy
objIF = new InterfaxIn.Inbound(); 
objItem  = new InterfaxIn.MessageItem();

When you’re done, continue to the ASP.NET fax examples, or see the advanced C# fax samples.