Faxing from ASP.NET

D

David Lozzi

Howdy,

I'm trying to send faxes from my asp.net code. I'm getting a "server threw
exception". Real helpful. here's my code


Dim FXServ As New FAXCOMLib.FaxServer
Dim FXDoc As FAXCOMLib.FaxDoc
Dim iFaxJob As Integer

'FXServ.Connect("SERVER")

FXDoc = CType(FXServ.CreateDocument("c:\test.txt"),
FAXCOMLib.FaxDoc)

FXDoc.FileName = "c:\test.txt"
FXDoc.FaxNumber = "15551231234"

iFaxJob = FXDoc.Send()

FXServ.Disconnect()


And here's the error


The server threw an exception.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server
threw an exception.

Source Error:


Line 74:
Line 75: FXDoc.FileName = "c:\test.txt"
Line 76: FXDoc.FaxNumber = "15551231234"
Line 77:
Line 78: iFaxJob = FXDoc.Send()


Source File: c:\inetpub\wwwroot\fax\default.aspx.vb Line: 76

Stack Trace:


[COMException (0x80010105): The server threw an exception.]
FAXCOMLib.IFaxDoc.set_FaxNumber(String pVal) +0
fax.WebForm1.btnFax_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\fax\default.aspx.vb:76
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292



Any advice is greatly appreciated!!

Thanks!

David
 
K

Ken Cox - Microsoft MVP

Hard to tell what it is without the COM component, but you might want to see
if you need to use

<%@ Page AspCompat="true" Language="C#" %>

"The AspCompat attribute forces the page to execute in STA mode. The runtime
throws an exception if the compatibility tag is omitted and an STA component
is referenced on the page. If you convert the STA component to an assembly
using Tlbimp.exe, the runtime does not detect that the component uses the
STA model and does not throw an exception, but your application can suffer
from poor performance.

Important
COM components that are created at construction time run before the request
is scheduled to the STA thread pool and consequently run on a multithreaded
apartment (MTA) thread. This has a substantial negative performance impact
and should be avoided. If you use AspCompat with STA components, you should
create COM components only from the Page_Load event or later in the
execution chain and not at page construction time. "


http://msdn2.microsoft.com/en-us/library/zwk9h2kb.aspx


David Lozzi said:
Howdy,

I'm trying to send faxes from my asp.net code. I'm getting a "server threw
exception". Real helpful. here's my code


Dim FXServ As New FAXCOMLib.FaxServer
Dim FXDoc As FAXCOMLib.FaxDoc
Dim iFaxJob As Integer

'FXServ.Connect("SERVER")

FXDoc = CType(FXServ.CreateDocument("c:\test.txt"),
FAXCOMLib.FaxDoc)

FXDoc.FileName = "c:\test.txt"
FXDoc.FaxNumber = "15551231234"

iFaxJob = FXDoc.Send()

FXServ.Disconnect()


And here's the error


The server threw an exception.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The server
threw an exception.

Source Error:


Line 74:
Line 75: FXDoc.FileName = "c:\test.txt"
Line 76: FXDoc.FaxNumber = "15551231234"
Line 77:
Line 78: iFaxJob = FXDoc.Send()


Source File: c:\inetpub\wwwroot\fax\default.aspx.vb Line: 76

Stack Trace:


[COMException (0x80010105): The server threw an exception.]
FAXCOMLib.IFaxDoc.set_FaxNumber(String pVal) +0
fax.WebForm1.btnFax_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\fax\default.aspx.vb:76
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292



Any advice is greatly appreciated!!

Thanks!

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top