473,382 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Fax in an asp.net page

Hi:

The following code work on win form application

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument("c:\Doc\test.pdf"),
FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()
when i port the code to web form

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument(Server.MapPath("") &
"\Doc\test.pdf"), FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()

It raise an exception "Access is denied. at
FAXCOMLib.FaxServerClass.Connect(String ServerName) at..."

If it is because of the IUSR account has no permission, then how do i
grant the permission to IUSR account so that it can access the Fax ? (I
don't know which resource to grant)

Another problem is (this happen in win form, but don't know it happen
in web form or not) when i try to fax the .pdf file it will launch the
adobe reader, how to avoid this ? at least the pdf viewer can close
automatically like when we fax the .txt document.

Please help (i need the solution urgently)
Thanks
JCVoon

Nov 19 '05 #1
9 2485
Your windows form is running under the current user, where as your web
application runs under the user selected in IIS.
By default this will be IUSR_<machine_name>

So you can either try use impersonation (this is set in the .config file,
either at the root or in the subfolder that contains this page):
http://msdn.microsoft.com/library/de...ersonation.asp

Or you can configure IIS to use an account that the fax machine allows
access to
in the default web site properties, click "Directory Security", then
click "Edit".
Change the Anonymous access use to be a user on your domain with access
to the fax machine

HTH

"jcvoon" <jc*******@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi:

The following code work on win form application

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument("c:\Doc\test.pdf"),
FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()
when i port the code to web form

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument(Server.MapPath("") &
"\Doc\test.pdf"), FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()

It raise an exception "Access is denied. at
FAXCOMLib.FaxServerClass.Connect(String ServerName) at..."

If it is because of the IUSR account has no permission, then how do i
grant the permission to IUSR account so that it can access the Fax ? (I
don't know which resource to grant)

Another problem is (this happen in win form, but don't know it happen
in web form or not) when i try to fax the .pdf file it will launch the
adobe reader, how to avoid this ? at least the pdf viewer can close
automatically like when we fax the .txt document.

Please help (i need the solution urgently)
Thanks
JCVoon

Nov 19 '05 #2
1. Use dcomcnfg.exe, find FAXCOMLib.FaxServer there and grant permissions to run/access to IUSR_ account.
2. The way how pdf is converted to tiff for faxing. The driver launches the application associated with that extension and command Print (or PrintTo) the application prints on the special FaxPrinter driver which has been installed with a fax system. The driver saves the output as a tiff for faxing.

So to launch another application you need to simply map that extension to it. You can use regular Windows Explorer, menu - Tools/Folder Options, tab - File Types. Hit Advance once found an extension to map verb Print or PrintTo.

George

"jcvoon" <jc*******@yahoo.com> wrote in message news:11**********************@f14g2000cwb.googlegr oups.com...
Hi:

The following code work on win form application

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument("c:\Doc\test.pdf"),
FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()
when i port the code to web form

Dim faxServer As FAXCOMLib.FaxServer
Dim faxDoc As FAXCOMLib.FaxDoc

faxServer = New FAXCOMLib.FaxServerClass
faxServer.Connect(Environment.MachineName)

faxdoc = CType(faxServer.CreateDocument(Server.MapPath("") &
"\Doc\test.pdf"), FAXCOMLib.FaxDoc)

faxDoc.RecipientName = "receiver"
faxDoc.FaxNumber = "12345"
faxDoc.DisplayName = "test"
faxDoc.Send()
faxServer.Disconnect()

It raise an exception "Access is denied. at
FAXCOMLib.FaxServerClass.Connect(String ServerName) at..."

If it is because of the IUSR account has no permission, then how do i
grant the permission to IUSR account so that it can access the Fax ? (I
don't know which resource to grant)

Another problem is (this happen in win form, but don't know it happen
in web form or not) when i try to fax the .pdf file it will launch the
adobe reader, how to avoid this ? at least the pdf viewer can close
automatically like when we fax the .txt document.

Please help (i need the solution urgently)
Thanks
JCVoon

Nov 19 '05 #3
Grant Merwitz :

I've try to add the IUSR_<machine_name> to users and administrator
group and restart my pc, but it still raise the access denied
exception, any idea ?

the impersonation, look complecated for me, i didn't try it.

Thanks
JCVoon

Nov 19 '05 #4
George:

I can't find the FAXCOMLib.FaxServer in the dcomcnfg.exe, I'm using
WinXP Pro, both IIS and Fax service is install on local machine, do i
need to register the fxscom.dll ?

I've follow your instruction, add a print action to the file type
(using Windows Explorer, > menu - Tools/Folder Options, tab - File
Types. Hit Advance), it still launch the acrobat reader (using my
winform application), is there a command line argument to tell the
acrobat reader run in invisible mode ?

Thanks
JCVoon

Nov 19 '05 #5
i think the problem is that the fax is another machine, and your
IUSR_<machine_name> is a local user that does not exist on your fax machine,
nor can it exist.
Or more importantly, it is not a domain account, and cannot gain access to
your fac machine.

by the way, you did substitute <machine_name> for the real name of your
machine.
like mine would be "IUSR_GrantsPC"
But anyway, i think impersonation is a viable option, and is really not that
complicated.

Its as simple as one line in your configuration file.
<configuration>
<system.web>
<identity impersonate="true" userName="domain\username"
password="password"/>
</system.web>
</configuration>

Add this line into you main web.config, and substitute the userName and
password for your username and password.
Make sure your account has access to the fax machine. i.e. If your logged
onto this computer, you can send a document to the fax machine

HTH

"jcvoon" <jc*******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Grant Merwitz :

I've try to add the IUSR_<machine_name> to users and administrator
group and restart my pc, but it still raise the access denied
exception, any idea ?

the impersonation, look complecated for me, i didn't try it.

Thanks
JCVoon

Nov 19 '05 #6
1. Check event log. It will have an error with a GUID of object needs to be given access to. You can look up in registry the human readable APPID for dcomcnfg.exe

2. You can not hide the Acrobat window. But i think it will be invisible when you run it from ASP.NEt account. You see it only because you are running it under your account. The ASP.NEt account can not output anything on monitor. So do not worry here.

George.
"jcvoon" <jc*******@yahoo.com> wrote in message news:11*********************@g44g2000cwa.googlegro ups.com...
George:

I can't find the FAXCOMLib.FaxServer in the dcomcnfg.exe, I'm using
WinXP Pro, both IIS and Fax service is install on local machine, do i
need to register the fxscom.dll ?

I've follow your instruction, add a print action to the file type
(using Windows Explorer, > menu - Tools/Folder Options, tab - File
Types. Hit Advance), it still launch the acrobat reader (using my
winform application), is there a command line argument to tell the
acrobat reader run in invisible mode ?

Thanks
JCVoon

Nov 19 '05 #7
Grant Merwitz :

Thank for the help.

Both the IIS and the Fax service is on the same WinXP Pro box.

My logon account is under adminstrator group, my Winform application is
able to print to the fax printer, but the Asp.Net application cannot.

I've try your suggession to add the <identity impersonate="true"
userName="VOON\jcvoon" password="mypassword"/> into the web config
file, and add
Response.Write(System.Security.Principal.WindowsId entity.GetCurrent().Name())
at the Page_Load event and i'm able to see the aps.net is currently
running under my account, but when i try to fax, it still prompt me
access denied !

End up i grant a permission to ASP.Net Machine Account (under priter
and fax, Fax properties | Fax security) so that it can manage fax
configuration, then my asp.net application can fax without a problem,
regardless whether there is a <identity impersonate="true"> entry
exists in the web.config file.

But i still don't understand why the impersonate, and the ASP.Net
account under administrator group not work.

Now remain another problem, when i fax the pdf file it will create the
AcroRd32.exe in the process, it cause my asp.net application hang after
a few AcroRd32.exe created in the process, do you have this problem ?
is it possible to kill the process manually after the fax has been send
out ?

Thanks
JCVoon

Nov 19 '05 #8
George:

Thanks for the help.

1. Grant a permission to ASP.Net machine account so that it can access
the fax printer solved my problem. I've check three of the event log
but i can't find a log that is related to access denied.

2. The Acrobat window is not visible when fax on the asp.net
application, but it did create a AcroRd32.exe process for each document
that i fax, after a few fax, the Acrord32.exe raise an exception "..The
memory could not be read...", my application hang. Do you know how to
solve this problem ? I plan to kill the process manually after the fax
has been fax, but i don't know how to identify which process to kill,
any idea ?

Thanks
JCVoon

Nov 19 '05 #9
Hi Grant Merwitz, George:

I've add the following code after faxServer.Disconnect()

Dim myProcesses() As Process
Dim myProcess As Process

' How to retrieve the program associat with pdf, when i only know the
file extenstion ?
myProcesses = Process.GetProcessesByName("AcroRd32")
For Each myProcess In myProcesses
Try
If Date.Now.Ticks - myProcess.StartTime.Ticks >
TimeSpan.FromSeconds(30).Ticks Then
myProcess.Kill()
End If
Catch ex As Exception
' Probably access denied
End Try
Next

But i'm not sure whether it is safe or not. If another session has
create another AcroRd32 process, can the process be kill by this
session ?

Thanks
JCVoon

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
4
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
8
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated?...
17
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
3
by: Mesut | last post by:
I have written a form in with radio buttons the name is set to orderby and the value is set to KundeVorName and the next value is KundeNachName and it goes so on. I wanna modify my query according...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.