Active Reports

C

CsaaGuy

I get OS errors when I run active reports from code.

The first error is with this code (beware of the commented out code)


Dim oPrinter As New System.Drawing.Printing.PrintDocument
oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
Dim oReport As New Report01
'oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
ClaimNumber = '08-M63254-4' and tblUsers.UserID =
tblAssignments.AdjusterId"
oReport.ds.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStringTLW")
oReport.Run()
oReport.Document.Print(False, False)

I get this error:

An unhandled exception of type
'System.Runtime.Serialization.SerializationException' occurred in
Unknown Module.

Additional information: The type
System.Drawing.Printing.InvalidPrinterException in Assembly
System.Drawing, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.



If i run it with this code (beware of the commented out code)

'Dim oPrinter As New System.Drawing.Printing.PrintDocument
'oPrinter.PrinterSettings.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
Dim oReport As New Report01
oReport.Document.Printer.PrinterName = "\\CSSFVPNT01\PSFB1F2BL01"
oReport.ds.SQL = "Select * from tblAssignments, tblUsers where
ClaimNumber = '08-M63254-4' and tblUsers.UserID =
tblAssignments.AdjusterId"
oReport.ds.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStringTLW")
oReport.Run()
oReport.Document.Print(False, False)

I get this error:


An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in Unknown Module.

Additional information: The RPC server is unavailable

As a Note, the report works in the webviewer.

Thanks.
 
C

CsaaGuy

Steve said:
By default ASP.NET runs under the ASPNET user account, which has limited
permissions. Specifically, this account does not have access to any
printers. All the errors you recieved are related to this fact. Therefore
you'll likely have better luck using impersonation to have ASP.NET run under
another account.

Here's more info on impersonation:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
It does some and thanks. I curious, why does it run from the web viewer?
 
S

Steve C. Orr [MVP, MCSD]

The web viewer sounds like a client side component, and the client does have
access to the printer.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top