<%@ Language=VBScript %>
<%
Option Explicit
Dim strSubmit
Dim strPRinterPath
Dim strUsername
Dim strPassWord
Dim strMessage
Dim objFS
Dim objWSHNet
Dim objPrinter
strSubmit = Request
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio
</HEAD>
<BODY>
<%
If strSubmit = "" Then
%>
注意的是
由於這是演示
真正的運用中應該對該登錄過程進行安全處理
<FORM action="ASPPrint
<TABLE WIDTH=
<TR>
<TD ALIGN=right NOWRAP>網絡打印機路徑:</TD>
<TD ALIGN=left NOWRAP><INPUT type="text" id=printerpath name=printerpath
value="< Domain >< Printer >"></TD>
</TR>
<TR>
<TD ALIGN=right NOWRAP>登錄帳號:</TD>
<TD ALIGN=left NOWRAP><INPUT type="text" id=username name=username
value="<% = strUsername %>"></TD>
</TR>
<TR>
<TD ALIGN=right NOWRAP>登錄口令:</TD>
<TD ALIGN=left NOWRAP><INPUT type="password" id=password
name=password></TD>
</TR>
<TR>
<TD ALIGN=right NOWRAP>請輸入你想打印的文字:</TD>
<TD ALIGN=left NOWRAP><TEXTAREA rows=
name=message></TEXTAREA></TD>
</TR>
<TR>
<TD ALIGN=right NOWRAP> </TD>
<TD ALIGN=left NOWRAP><INPUT type="submit" value="Submit"
id=submit name=submit></TD>
</TR>
</TABLE>
</FORM>
當以上信息被提交後
<%
Else
strPrinterPath = Request
strUsername = Request
strPassword = Request
strMessage = Request
We will now use the VBScript FileSystemObject object and the WSH Network object
give us the methods we need to open a printer connection
output to the printer
Set objFS = CreateObject("Scripting
Set objWSHNet = CreateObject("WScript
objWSHNet
Set objPrinter = objFS
objPrinter
On Error Resume Next
objPrinter
If Err Then
Response
Err
Else
Response
Response
Response
Response
Response
Response
Response
Response
Response
Response
End If
objWSHNet
Set objWSHNet = Nothing
Set objFS = Nothing
Set objPrinter = Nothing
End If
%>
</BODY>
</HTML>
From:http://tw.wingwit.com/Article/program/net/201311/14243.html