Click here to Skip to main content
15,897,704 members

Text file printing is working from development server but not working from IIS

binu.emiliya asked:

Open original thread
Dear All,

I want to print bar codes from an asp.net application.I am using Zebra printer and i have created text files from my application below are the code to create text file
Using dr As SqlDataReader = cmd.ExecuteReader()

              Using StringWriter
                  StringWriter.WriteLine("CT~~CD,~CC^~CT~")
                  StringWriter.WriteLine("^XA~TA000~JSN^LT0^MNW^MTD^PON^PMN^LH0,0^JMA^PR2,2~SD15^JUS^LRN^CI0^XZ")
                  While dr.Read()
                      Dim linex As String = "^FD>;" & dr.Item("BARCODEVALUE") & "^FS"
                      StringWriter.WriteLine("^XA")
                      StringWriter.WriteLine("^MMT")
                      StringWriter.WriteLine("^PW406")
                      StringWriter.WriteLine("^LL0203")
                      StringWriter.WriteLine("^LS0")
                      StringWriter.WriteLine("^BY3,3,82^FT51,113^BCN,,Y,N")
                      StringWriter.WriteLine(linex)
                      StringWriter.WriteLine("^PQ1,0,1,Y^XZ")
                  End While
              End Using
          End Using

This is working fine if i am typing from dos prompt
Type filename.txt >prn

Now i have created a function to print like below
Dim proc As New System.Diagnostics.Process
        With proc.StartInfo
            .FileName = "cmd.exe"
            .Arguments = _shellcmd
        End With

        proc.Start()

where _shellCmd is the command to call dos printing
Dim shellcommand As String = "/C copy " & barcodefile + " lpt1"

this all working from dev server,but after publishing when i press the button nothing happend.I published the site in the same system where the printer is installed and add Defaultpool users to the printer and gave permission to print but still nothing happening.Please help

What I have tried:

Created the barcode text file and it printed from asp.net application which is in development stage
Tags: ASP.NET, DOS, Print

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900