?
Solved

Print Button shows error from Crystal viewer in asp.net 2.0 application after deploying to live server

Posted on 2008-10-18
3
Medium Priority
?
627 Views
Last Modified: 2013-11-07
We have deployed our asp.net 2.0 application onto the live server. We are using Crystal Reports XI Release 2 for the reports and displaying the same in Crystal viewer. When user clicks Report the viewer displays the report correctly. When user clicks Print button on the viewer control, he gets the first screen where he clicks ok and gets a dialog box for Open / Save pdf. When he clicks open, we get error, in one pc is displays - There was an error opening this document, this file could not be found, in Another it displays Access is denied - with a path to c:\windows\temp\...
0
Comment
Question by:venkatca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22748655
Check the permissions on the server C:\Windows\temp directory.

mlmcc
0
 
LVL 1

Author Comment

by:venkatca
ID: 22751077
Already given permissions to IUSR and Network Services to c:\windows\temp directory. Also by default crystal viewer print option in asp.net 2.0 opens a dialog box to open the file in acrobat reader from where the user can print. The acrobat reader opens and then the message file cannot be found is displayed from within the reader if user chooses to Open it. If saved and opened, there is no problem.
0
 
LVL 1

Accepted Solution

by:
venkatca earned 0 total points
ID: 22802870
We finally created our own solution for this by opening the adobe reader ourselves instead of using the default provided by crystal viewer.

For this we created a print button on the form and disabled the print button on the viewer.

The print button code is below
    Protected Sub btnPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Session.Add("ReportSource", rep)
        Dim strpop As String = ""
        strpop = "window.open('RptPrintPage.aspx','PopUpPrint','width=1010,height=650 left=0,top=0 scrollbars=yes,status=yes');"
        ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "popup", strpop, True)
    End Sub

And in the rptprintpage.aspx which shows the report in pdf for printing, we added the following in page init


    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Try
            rep = New ReportDocument()
            If Session("ReportSource") Is Nothing = False Then
                rep = CType(Session("ReportSource"), ReportDocument)
            End If

            Response.Buffer = False
            Response.ClearContent()
            Response.ClearHeaders()
            rep.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, "Report")

        Catch ex As Exception

        End Try
    End Sub
0

Featured Post

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question