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
621 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 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