I would like to share a small but yet valuable information about FAXCOM.dll to send fax.
We can send FAX using either through modem or using mailserver.
I have used modem to send fax. I have encountered a number of errors while doing this. I would like to share them with u all, because I havent seen much information about this application on the net nor in any forum.
Requirements for sending FAX using FAXCOM.dll (system32 dll)
1) Refer to the FAXCOM.dll in c:\winnt\system32
2) Install Fax Services (FAX drivers)
3) Fax service should be in running/automatic mode.
4) Modem which is used to connect to the internet to send the fax.
(Install modem drivers and make sure that the modem is shown in the device manager).
5) User should have enough permission to send the fax. (Admin privilages)
Example:
------------
Expand|Select|Wrap|Line Numbers
- FAXCOMLib.FaxServer fxsrv = new FAXCOMLib.FaxServer();
- FAXCOMLib.FaxDoc fxdoc = (FAXCOMLib.FaxDoc)fxsrv.CreateDocument("fbharath.txt");
- try
- {
- fxdoc.FileName = "fbharath.txt";
- fxdoc.FaxNumber = "914023391105"; //Main
- fxdoc.RecipientName = "Bharath Reddy VasiReddy";
- fxdoc.RecipientOffice = "eXensys";
- fxdoc.RecipientOfficePhone = "04023000891";
- fxdoc.RecipientState="Andhra Pradesh";
- fxdoc.RecipientDepartment = "Development";
- fxdoc.RecipientCountry="India";
- fxdoc.RecipientCity = "Hyderabad";
- fxdoc.RecipientAddress = "White Fields Servery No:6";
- fxdoc.RecipientCompany = "eXensys Software Solutions Ltd";
- fxdoc.SenderAddress="White Fields Servery No:6";
- fxdoc.SenderCompany = "eXensys";
- fxdoc.SenderDepartment = "Development";
- fxdoc.SenderHomePhone ="04023000981";
- fxdoc.SenderTitle = "Bharath Reddy";
- fxdoc.FileName = "fbharath.txt";
- fxdoc.FaxNumber = "914023391105"; //Main
- fxdoc.RecipientName = "Bharath Reddy VasiReddy";
- fxdoc.RecipientOffice = "eXensys";
- fxdoc.RecipientOfficePhone = "04023000891";
- fxdoc.RecipientState="Andhra Pradesh";
- fxdoc.RecipientDepartment = "Development";
- fxdoc.RecipientCountry="India";
- fxdoc.RecipientCity = "Hyderabad";
- fxdoc.RecipientAddress = "White Fields Servery No:6";
- fxdoc.RecipientCompany = "eXensys Software Solutions Ltd";
- fxdoc.SenderAddress="White Fields Servery No:6";
- fxdoc.SenderCompany = "eXensys";
- fxdoc.SenderDepartment = "Development";
- fxdoc.SenderHomePhone ="04023000981";
- fxdoc.SenderTitle = "Bharath Reddy";
- fxsrv.Connect(Environment.MachineName);
- fxdoc.Send();
- fxsrv.Disconnect();
I got an exception called "Unspecified error" at fxsrv.Connect(Environment.MachineName); method call which was System.Runtime.InteropServices.COMException. This exception will be thrown when an unrecognized HRESULT is returned from a COM method call.
If u get the same error:
1) Delete the reference to the dll and add it again.
2) In my case the Fax dirvers where not installed correctly, when I have reinstalled the drivers it worked out.
3) Very likely you have run into permission issues. You have to fix your authentication and authorization for web application.
5) Does your application accesses any file resources in folder other than your web application.
6) Does your application accesses any resources over the network ?.
Is the call related to some network operation.
7) Your application might be running currently logged in user, this user probably is missing admin previleges.
8) Asp.Net running under asp.net user account which is very limited previleges account.
9) Asp.net default user doesnt have rights to activate COM objects we need to add user with sufficient rights and use the identity tag in web.config to set this user.
If we use windows authentication (anonymous not set) and we users go rights to activate COM objects we can see identity tag with impresonate = true attribute.
<%@ Page ASPCOMPAT = "true" language="C#">
Please refer to the previous article posted by me to know the status of the fax operation.Weather it has been sent succesfully or not. at : http://www.thescripts.com/forum/thread650334.html
Thanks & Regs
Bharath Reddy VasiReddy