PrintToPrinter command does not work on the web server?

G

Guest

I am having problems with the PrintToPrinter command. It works fine in the
development environment but when I try using this on the web server it does
not work.

I am having problems debuging this because I get an error when my code hits
the msgbox command as well "Showing a modal dialog box or form when the
application is not running in UserInteractive mode is not a valid
opperation". I have a feeling this is because the code is in the page_load
sub.

Does anyone know why the PrintToPrinter command does not work?
This is my code.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Dim Stage As Integer = 0
Dim myPrintOptions As PrintOptions = NonJSDeliveryNote.PrintOptions

myPrintOptions.PrinterName = Session("Printer").ToString()
If Not IsPostBack Then
Try
NonJSDeliveryNote.PrintToPrinter(1, False, 0, 0)
Stage = 1
Response.Redirect("ShipSummary.aspx")
Exit Try
Catch ex As Exception
If Stage = 0 Then
MsgBox(ex.Message)
End If
End Try
End If
End Sub
 
G

Guest

This turned out to be an ODBC problem. The DNS name on the server was
different to the name I used when developing the reports so it couldn't
connect to the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top