Re: Printing from an ASP.NET page



Thanks for your reply Brett,

Yes, webservice or even simple network socket programming is ok(or if you
can use .net 3.0, WCF will be much more convenient). Also, if you are
familar with MSMQ programming, you can consider make each print request as
a MSMQ message and send to a message queue, and your target winform
application constantly pick messages from queue and perform printing.

For the console application, do not call it from your ASP.NET application,
that way, you are doing the samething as you try calling winform printing
code in asp.net application since that will make the consile running in the
same user context of the ASP.NET web applicaction. You should run the
console or winform application from a logon user context and let the
asp.net application communicate it via some remote communication methods.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Brett" <brettlf@xxxxxxxxxxxxxxxx>
References: <OxehiRt4IHA.1428@xxxxxxxxxxxxxxxxxxxx>
<e#FIbdw4IHA.4688@xxxxxxxxxxxxxxxxxxxxxx>
<OC0d#f14IHA.832@xxxxxxxxxxxxxxxxxxxx>
<5AVjijV5IHA.1624@xxxxxxxxxxxxxxxxxxxxxx>
<#DVj5Nf5IHA.1420@xxxxxxxxxxxxxxxxxxxx>
<L2FYPQi5IHA.5840@xxxxxxxxxxxxxxxxxxxxxx>
<#NtMCWr5IHA.1592@xxxxxxxxxxxxxxxxxxxx>
<sOBPTRv5IHA.4500@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Printing from an ASP.NET page
Date: Wed, 16 Jul 2008 16:34:12 -0400


Yes, I could run the printing part as a Winform application. I'm not sure
how I should implement it. (.NET remoting? Web service?) The
communication between applications would be a new area for me.

I found an article on MSDN that shows how to use a console application to
print a local report without previewing it:
http://msdn.microsoft.com/en-us/library/ms252091(VS.80).aspx
When I ran the console application , it successfully printed the report,
but
when I tried to call the console app from the web app, I got
"PrintLocalReport has encountered a problem and needs to close."

Error signature:
EventType : clr20r3 P1 : printlocalreport.exe P2 : 1.0.0.0
P3 : 487e4d71 P4 : mscorlib P5 : 2.0.0.0 P6 : 471ebc5b
P7 : 3404
P8 : d8 P9 : system.io.filenotfoundexception

The following code fails at "Dim p As System.Diagnostics.Process."

Dim filePath As String = Server.MapPath("PrintLocalReport.exe")

Dim info As System.Diagnostics.ProcessStartInfo = New
System.Diagnostics.ProcessStartInfo(filePath, "")

info.UseShellExecute = False

Dim p As System.Diagnostics.Process =
System.Diagnostics.Process.Start(info)

p.Start()


I don't know what file was not found. I did a "File.exists(filepath)" and
it returned "True"


.



Relevant Pages

  • Re: Console Application Alternate Windows Credentials
    ... ConsoleApplicationCredentials to the module of my console application ... phtoken As IntPtr) As Boolean ... Dim lpMsgBuf As String ... Dim impersonatedUser As WindowsImpersonationContext ...
    (microsoft.public.dotnet.security)
  • Re: Multiple simulataneous forms in a sinlge application
    ... Actually, I'm quite familiar with how Winform applications work, I ... forms (nope, 'modeless forms' doesn't work, I tried). ... I'm creating the application as a console program. ... >> console first for debug purposes (I have a personal Debug class that ...
    (microsoft.public.dotnet.languages.vc)
  • Re: vb6 run from and output to command window
    ... VB doesn't really create true console applications (because the linker ... allocate the console window, and read/write from/to it. ... Private Declare Function AllocConsole Lib "kernel32" As Long ... Dim lResult As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: vb6 run from and output to command window
    ... > VB doesn't really create true console applications (because the linker ... AllocConsole to allocate the console window, ... > Dim lResult As Long ... > Function ConsoleWriteLn(sOutput As String) As Boolean ...
    (microsoft.public.vb.general.discussion)
  • Re: Multiple simulataneous forms in a sinlge application
    ... > should I have given the search engine in MSDN2 in order to find out about ... > modeless forms. ... apparently you are quite new to winform and have problem understanding ... I'm creating the application as a console program. ...
    (microsoft.public.dotnet.languages.vc)

Loading