|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 303647 - Last Review: February 12, 2007 - Revision: 4.5 How To Send a Fax from an ASP Page on Windows 2000This article was previously published under Q303647 This article describes how to use Microsoft Fax Service to
send a fax from an Active Server Pages (ASP) page. The Microsoft Fax Service
includes Component Object Model (COM) interfaces that expose functionality that
is contained in the Faxcom.dll file. By making calls to Faxcom.dll, you can
instantiate the necessary object to send a fax from any client program that
supports COM. For more information about the FaxServer objects and their functionality, see the "References"
section. IMPORTANT: You cannot fax all file types from ASP and or a service. This
article demonstrates how to fax a text document; further configuration or a
different method may be necessary to fax documents of a different type.
Step-by-Step ExampleMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
(https://partner.microsoft.com/global/30000104)
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
(http://support.microsoft.com/gp/advisoryservice)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
(http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
To call the functionality that is contained in the FaxServer objects from ASP, follow these steps:
- Open Microsoft Visual Basic.
- From the New Project dialog box, click ActiveX DLL, and then click Open.
- Rename the Visual Basic project
FaxComWrapper.
- Rename the default Class1 module
FaxSend.
- Add the following code:
Public Function SendFax(FileName As Variant, FaxMachine As Variant, FaxNumber As Variant)
Set FaxServer = CreateObject("FaxServer.FaxServer")
FaxServer.Connect ("\\" & FaxMachine)
Set FaxDoc = FaxServer.CreateDocument(FileName)
With FaxDoc
.FaxNumber = FaxNumber
.Send
End With
Set FaxDoc = Nothing
Set FaxServer = Nothing
End Function
- Save the project to the C:\ASPFax\ folder.
- Compile the FaxComWrapper project to the C:\ASPFax\ folder,
and name it FaxComWrapper.dll.
- From the Start menu, point to Programs, point to Administrative Tools, and then click Component Services to open the Microsoft Management Console for Component Services
(which is referred to as the console for the remainder of this
article).
- In the left pane of the console, click to expand the Component Services, Computers, My Computer, and COM+ Applications nodes.
- Click to select COM+ Applications. From the Action menu, point to New, and then click Application. Follow these steps in the COM Application Install Wizard:
- On the first page of the wizard, click Next.
- On the second page of the wizard, click Create
an Empty Application, type FaxSendWrapper as
the name of the application, and then click Next.
- On the Set Application Identity page, click This User, and type the Administrator account and password credentials.
This ensures that the application has the required permissions; however, you
can modify this entry for a specific security configuration.
- Click Next, and then click Finish.
- Notice that the newly created application, FaxSendWrapper,
appears in the list of COM+ applications on your computer. In the left pane,
click to expand FaxSendWrapper, and then click to select Components. From the Action menu, point to New, and then click Component. Follow these steps in the COM Component Install Wizard:
- In the first page of the wizard, click Next.
- In the second page of the wizard, click Import
component(s) that are already registered.
- In the list that is generated, click FaxComWrapper.FaxSend.
- Click Next, and then click Finish.
- Open Microsoft Visual InterDev, and create a new project.
Add a new blank ASP page.
- Add the following code to the ASP page:
<%
Set FaxWrapper = Server.CreateObject("FaxComWrapper.FaxSend")
Dim strFileName
Dim strFaxMachine
Dim strFaxNumber
strFileName = "<Insert Filename Here>"
strFaxMachine = "<Insert FaxMachine Here>"
strFaxNumber = "<Insert FaxNumber Here>"
FaxWrapper.SendFax strFileName, strFaxMachine, strFaxNumber
Set FaxWrapper = Nothing
%>
- Run the ASP page.
NOTE: The code for the Visual Basic dynamic-link library (DLL) that is
included in this article is intended as a sample demonstration only. This code
still requires error handling and must be tested thoroughly if you want to
incorporate this concept in production code. For more information on the Fax Service Client application
programming interface (API), refer to the following MSDN Web site: For more information on COM+ development for Visual Basic, refer
to the following MSDN Web site:
APPLIES TO- Microsoft Active Server Pages 3.0, when used with:
- the operating system: Microsoft Windows 2000
| kbaspobj kbcodesnippet kbhowto kbsample kbscript KB303647 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
|
 |
 |
 |
 |
 |
 |
 |
| |