/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
Server Side Printing from .asp
Fra : Jan Welten


Dato : 09-01-01 01:29

Hi!

I'm lost!! Anyone got any idea why this doesn't work ???

<%

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objWSHNet = CreateObject("WScript.Network")

objWSHNet.AddPrinterConnection "LPT1", "<prtshare>", False, "<username>",
"<password>"

Set objPrinter = objFS.CreateTextFile("LPT1", True)
objPrinter.Write("This is the message I'd like to print...")
objPrinter.Close

objWSHNet.RemovePrinterConnection "LPT1"
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing

%>


When swapping the <xxx> tags with real info, it just gives me the message
"error 80070520 - A specified logon session does not exist. It may already
have been terminated."

I'm not using sessioncookies.. but why would I need to do that.. when
username/password is already provided in the script ??? Any workarounds ???
...or any easily implemented print-components ???

...or would there maybe be a simple way of printing directly to a server
defined printer without starting a session of the WScript.Network
component??


regards

Jan Welten
Sydney, Australia

(copy of answers to my e-mail address please...




 
 
Peter Pehrson (24-01-2001)
Kommentar
Fra : Peter Pehrson


Dato : 24-01-01 01:02

local ports are probably not supported, and certainly not from ASP....


On Tue, 9 Jan 2001 11:29:28 +1100, "Jan Welten" <jan@questa.com.au>
wrote:

>Hi!
>
>I'm lost!! Anyone got any idea why this doesn't work ???
>
><%
>
> Set objFS = CreateObject("Scripting.FileSystemObject")
> Set objWSHNet = CreateObject("WScript.Network")
>
> objWSHNet.AddPrinterConnection "LPT1", "<prtshare>", False, "<username>",
>"<password>"
>
> Set objPrinter = objFS.CreateTextFile("LPT1", True)
> objPrinter.Write("This is the message I'd like to print...")
> objPrinter.Close
>
> objWSHNet.RemovePrinterConnection "LPT1"
> Set objWSHNet = Nothing
> Set objFS = Nothing
> Set objPrinter = Nothing
>
>%>
>
>
>When swapping the <xxx> tags with real info, it just gives me the message
>"error 80070520 - A specified logon session does not exist. It may already
>have been terminated."
>
>I'm not using sessioncookies.. but why would I need to do that.. when
>username/password is already provided in the script ??? Any workarounds ???
>..or any easily implemented print-components ???
>
>..or would there maybe be a simple way of printing directly to a server
>defined printer without starting a session of the WScript.Network
>component??
>
>
>regards
>
>Jan Welten
>Sydney, Australia
>
>(copy of answers to my e-mail address please...
>
>


Søg
Reklame
Statistik
Spørgsmål : 177557
Tips : 31968
Nyheder : 719565
Indlæg : 6408868
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste