
Printing Using ASP and WSH
Hello,
Running Window 2000 Server with IIS.
We want to print to a printer from an ASP page
using the following code:
' Create FileSystem Object and Windows Script Host Network Object
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")
' Connect to Network Printer from Windows Script Host
strPrinterPath = "\\XXXX\lab10_laser"
strUsername="userid"
strPassword = "password"
strMessage = "xyz"
objWSHNet.AddPrinterConnection "lpt1:", strPrinterPath, False,
strUsername, strPassword
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When the "AddPrinterConnection" method is executed we receive the following
error:
Error Type:
WSHNetwork.AddPrinterConnection (0x80070520)
A specified logon session does not exist. It may already have been
terminated.
/fence/prbk.asp, line 51
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
We have tried various userid/passwords with same result.
Any help appreciated,
Gary