日期:2014-05-17  浏览次数:20982 次

如何用asp发传真?
如何用asp发传真?
我在微软看到win2000   发传真的方案。
http://support.microsoft.com/kb/303647/zh-cn
我是在WinXP下开发,但总是提示错误

Error   Type:
FaxComWrapper   (0x80070006)
Method   '~ '   of   object   '~ '   failed
/FaxTest2.asp,   line   23

望哪位高手帮忙解决啊!
急等

------解决方案--------------------
错误的类型,你在ActiveX DLL里怎么写的,大概步骤是这样的:
先引用Faxcom 1.0 Type Library或Faxadmin 1.0 Type Library(我的机器是win2kServer,只看到这两个可以用的FAX引用);
然后自己Public 几个对象,为 As New FAX??????
用定义好的对象写几个函数,实现传真 收,发;
保存为DLL;
注册;
ASP调用;

步骤就是这样子,具体过程中就自己多注意了!
------解决方案--------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FAXCOMEXLib;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String fileName = " ";

String faxNumber = " ";

fileName = Request.QueryString[ "fileName "];

faxNumber = Request.QueryString[ "faxNumber "];

if (faxNumber != " ")
{
SendFaxEx(Server.MapPath(@ "\fax\ "+fileName), faxNumber);

Response.Write( " <center> Send Fax completed! </center> ");

Response.Write( " <center> <a href=javascript:self.close() > Close </a> </center> ");
}
}

public void SendFaxEx(string fullname, string faxnumber)
{
if (faxnumber != " ")
{
try
{
FAXCOMEXLib.IFaxServer fax = new FAXCOMEXLib.FaxServerClass();

fax.Connect( " ");

FAXCOMEXLib.IFaxDocument faxDoc = new FAXCOMEXLib.FaxDocumentClass();

faxDoc.DocumentName = "MedFirst_FaxServer ";

faxDoc.Body = fullname;

faxDoc.Recipients.Add(faxnumber, " ");

//doc.Sender.Email = email;

faxDoc.Sender.SaveDefaultSender();

faxDoc.Submit(null);

fax.Disconnect();
}
catch (Exception Ex)
{
Response.Write(Ex.Message);
}
}
}
}