re:
!Natively, you have no chance whatsoever of doing this... As I said, a web
!application has no way of interfacing natively with the hardware on which
!the client browser is running - in fact, all modern browsers are designed
!specifically to prevent this, for fairly obvious security reasons...
A wet dream if I've ever seen one.
Just imagine a web app which can trigger millions of client printers to start printing.
:-)
Enabling a client to print a page, with the ability
to select a printer they have installed, is as simple as :
<input type="button" value="Print" onClick="window.print()">
or
<a href="javascript
:window.print()">Print</a>
If you don't want to show the button, or the text "Print", you could use :
<body onLoad="window.print()">
....and advice the user that the printer dialog will be shown, in the referring link.
While asp.net developers deal mainly with server events,
it's easy to downstream a choice to a client using Javascript.
Juan T. Llibre, asp.net MVP
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en español :
http://asp.net.do/foros/
======================================
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message news:OC**************@TK2MSFTNGP04.phx.gbl...
"David C. Barber" <da***@NOSPAMdbarber.comwrote in message news:_Z******************************@comcast.com. ..
>"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OF**************@TK2MSFTNGP04.phx.gbl...
>>"David C. Barber" <da***@NOSPAMdbarber.comwrote in message
news:zZ******************************@comcast.co m...
my.computer.printers.defaultprinter doesn't exist in 2005, despite the
plethora of examples still out on the web detailing its use.
So how can I determine a person's default printer using ASP 2?
You can't - ASP.NET has no way of interfacing directly with the hardware
on
>>the machine on which the client browser is running...
What use would this information be anyway...?
>I have a user printing out of the Crystal Reports Viewer control version XI
R2. I need to know when they are printing, and unlike the VB6 version of
this control where you could trap the Print Event on the control itself,
there is no option for that in ASP that I've been able to determine.
Indeed not... WinForms and WebForms are *totally* different... When a webserver (IIS or whatever) streams down a page
to a client browser, it has no further interaction with that client browser until / unless that client browser sends
it another HttpRequest - there is no permanent connection...
Controlling and querying printers is a breeze in a WinForms app because the app is running on the local machine. This
isn't the case with ASP.NET, which runs on a webserver not the client machine.
>Even if it's harder to determine the default printer for a user, it should
hardly be impossible. But I don't know what to try next in this regard, and
was hoping for some help here.
Natively, you have no chance whatsoever of doing this... As I said, a web application has no way of interfacing
natively with the hardware on which the client browser is running - in fact, all modern browsers are designed
specifically to prevent this, for fairly obvious security reasons...
Your only hope would be to use something like WSH, but that would only work in IE (it's ActiveX) and would require you
to seriously ramp down your security - I can't advise you to even consider this...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net