How to realize the function of network Printing in ASP

Source: Internet
Author: User
Tags file system print object visual studio
Printing | How the network uses ASP for print operations
Technology to use:
Asp,wsh,vbscript
The file aspprint.asp code is as follows:
<%@ Language=vbscript%>
<%
Option Explicit

The value in the Dim strsubmit ' form to hold the Submit button
Value of saving network printer path in Dim strprinterpath ' form
Value of user name in Dim strusername ' form
The value of the password in Dim strpassword ' form
Dim strmessage ' form prints the value of the content
File system objects in Dim OBJFS ' VBScript
Network objects in Dim objwshnet ' WSH
Dim objprinter ' Print object

Strsubmit = Request.Form ("Submit")
%>

<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD>
<BODY>

<%
If strsubmit = "" Then
%>

Note that:
Because I am a demo, where the account and password for NT are used unencrypted means to pass in the ASP
The login process should be handled securely in the real application.
<form action= "aspprint.asp" Method=post id=form name=form>
<table width=100% align=center border=0 cellspacing=1 cellpadding=1>
<TR>
&LT;TD align=right nowrap> Network printer path:</td>
&LT;TD align=left nowrap><input type= "text" Id=printerpath Name=printerpath
Value= "\\< Domain >\< Printer >" ></TD>
</TR>
<TR>
&LT;TD align=right nowrap> Login account:</td>
&LT;TD align=left nowrap><input type= "text" Id=username Name=username
value= "<% = strUserName%>" ></TD>
</TR>
<TR>
&LT;TD align=right nowrap> Login Password:</td>
&LT;TD align=left nowrap><input type= "password" Id=password
Name=password></td>
</TR>
<TR>
&LT;TD align=right nowrap> Please enter the text you want to print:</td>
&LT;TD align=left nowrap><textarea rows=2 cols=20 id=message
Name=message></textarea></td>
</TR>
<TR>
&LT;TD align=right nowrap> </TD>
&LT;TD align=left nowrap><input type= "Submit" value= "Submit"
Id=submit name=submit></td>
</TR>
</TABLE>
</FORM>

Once the above information has been submitted, it can be printed with the following code.
<%
Else
' Get the response information from the form.
Strprinterpath = Request.Form ("PrinterPath")



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.