Re: Writing to a printer from a WSH script called by ASP
From: Roland Hall (nobody_at_nowhere)
Date: 10/21/04
- Next message: Roland Hall: "Re: Login Script"
- Previous message: James: "Re: How to compare 2 files"
- In reply to: Schadrach: "Re: Writing to a printer from a WSH script called by ASP"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 21 Oct 2004 11:22:50 -0500
"Schadrach" wrote in message
news:1098320686.170352.208660@f14g2000cwb.googlegroups.com...
: Err, there are plenty of reasons for wanting to do this. The one that
: people giving examples like to cite is firing of shipping labels to the
: shipping & receiving dept when something is ordered on an e-commerce
: site. In my case, we have a specialized piece of hardware made to
: print plastic/metal tags, and an intranet app that already manages the
: data that need to go on them. Anyone who can access the page that
: prints the tags has already been authenticated by the system as being
: an employee whose responsibilities may include producing said tags.
Schadrach...
I took Gerry's suggestion and wrote a small example and tested it. My setup
will be a little different from yours so yours may have better results.
This is my setup:
Workstation sharing a USB printer on domain1
W2K Adv. Server running IIS on domain2
I mapped lpt1 on the server to the printer share on the workstation
I made a virtual directory [bob] on one of the server's partitions and put
my .asp file in it.
Rights: Administrators (Full), IUSR_FS1 (RX).
I created a data directory [bobdata].
Rights: Administrators(Full), IUSR_FS1 (R)
I call the .asp file which is written to copy ticket1 to lpt1, which
hopefully will send it to the printer.
My results are:
1. When calling the .asp file from the workstation, I get prompted for
credentials [anonymous users are disabled] and even though I give it admin
credentials, I get permission denied.
2. When calling the .asp file from the server [same way]
http://fs1/bob/printit.asp, it works. The line number that returns for
Permission Denied is line 22, the copy line.
Here is my code:
<%@ Language=VBScript %>
<%
Option Explicit
Response.Buffer = True
Const strPath = "d:\bobdata\"
sub goPrint(strFile)
dim fso, strPort
set fso = CreateObject("Scripting.FileSystemObject")
strPort = "lpt1"
Response.Write "Printing " & ucase(strFile) & "..."
fso.CopyFile strPath & strFile, strPort
set fso = nothing
Response.Write "complete!"
end sub
goPrint "ticket1"
%>
Error:
Technical Information (for support personnel)
a.. Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
/bob/printit.asp, line 22
b.. Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
c.. Page:
GET /bob/printit.asp
d.. Time:
Thursday, October 21, 2004, 11:50:16 AM
My web server is not part of my other domain so I cannot test a system in
that domain without config changes to one of my workstations. Perhaps you
will have better results. If that doesn't work, I have one other
possibility.
-- Roland Hall /* This information is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. */ Technet Script Center - http://www.microsoft.com/technet/scriptcenter/ WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp
- Next message: Roland Hall: "Re: Login Script"
- Previous message: James: "Re: How to compare 2 files"
- In reply to: Schadrach: "Re: Writing to a printer from a WSH script called by ASP"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|