Crystal Reports for VS2005 ExportToHTTPResponse gives "Invalid report file path" on deployed server

I have a ASP.Net application developed in C# on Win2k SP4, VS2005 SP1 using CR for VS2005. The application allows the user to select different reports and the selection and filtering criteria for those reports.  The user can then view the report using the embedded CrystalReportViewer control and print the report via exporting it to a PDF file.  Everything works great on my development machine.  When deployed to a Win2k3 server, using a web setup deployment project that contains the CR merge modules, the report loads in the CrystalReportViewer as expected.  When I attempt to print it via the ExportToHTTPResponse function I get a "Invalid report file path" error. I included the Page_Load event code, which loads the report into the CrystalReportsViewer webcontrol, as well as the btnPrint_Click code, which lauches the report in PDF format, in the development environment, and gives the "Invalid report file path" error on the deployment machine.  What am I missing?

 //Start of code

protected void Page_Load(object sender, EventArgs e)

{

string lOldTmp = System.Environment.GetEnvironmentVariable( "TMP" );

try

{

string lParam;

string lValue;

if ( !IsPostBack )

{

#region Get the Crystal Reports Temp directory from web.config

string lCRTemp = WebConfigurationManager.AppSettings.Get( "CRTempDir" );

System.Environment.SetEnvironmentVariable( "TMP", lCRTemp );

#endregion if ( Request.QueryString["ReportName"] != null )

{

Session["ReportName"] = crsReport.Report.FileName = Server.MapPath( "Reports\\" +

Request.QueryString["ReportName"] );

Session["ReportDocument"] = mReport = crsReport.ReportDocument;

mReport.Load( Session["ReportName"].ToString() );

}

else

{

throw new Exception( "Report name missing." );

}

if ( Session["ReportData"] != null )

{

DataTable lData = (DataTable)Session["ReportData"];

mReport.SetDataSource( lData );

}

else

{

throw new Exception( "Report Data was not retrieved." );

}

#region Assign the parameter values.for ( int i = 1; i < Request.QueryString.Count; i++ )

{

lParam = Request.QueryString.GetKey( i );

lValue = Request.QueryString[lParam];

if ( lParam == "SessionParameters" )

{

IDictionary<string, string> lParams = new Dictionary<string, string>();

lParams = (IDictionary<string, string>)Session[lValue];

foreach ( KeyValuePair<string, string> Param in lParams )

{

mReport.SetParameterValue( Param.Key, Param.Value );

}

}

else

{

mReport.SetParameterValue( lParam, lValue );

}

}

#endregion

}

#region Set the page titleswitch ( Request.QueryString["ReportName"] )

{

case "Under250.rpt":

{

Page.Title = "Under $250M Capital Plan";

break;

}

case "RCEApproved.rpt":

{

Page.Title =
"RCE's Approved";break;

}

case "Status.rpt":

{

Page.Title = "Capital Project Status";

break;

}

case "ProjectListing.rpt":

{

Page.Title =
"Project Listing";break;

}

case "WorkLoad.rpt":

{

Page.Title = "Engineering Workload Listing";

break;

}

case "Summary.rpt":

{

Page.Title =
"Summary Information";break;

}

case "ManHours.rpt":

{

Page.Title = "Project Engineering - Time by Week";

break;

}

case "WorkLoadSummary.rpt":

{

Page.Title =
"Workload Summary";break;

}

default:

{

Page.Title = "Engineering Project Tracker Report";

break;

}

}

#endregion

}

catch ( Exception ex )

{

Session[
"ErrorMsg"] = "Crystal Reports Error:\n" + ex.Message +

( ex.InnerException != null ? ( "\n" + ex.InnerException.Message ) : "" );

Response.Redirect( "Reports.aspx?ErrorMsg=Session", true );

}

finally

{

//Change the value back

System.Environment.SetEnvironmentVariable( "TMP", lOldTmp );

}

}

protected void btnPrint_Click( object sender, EventArgs e )

{

try

{

if ( mReport == null )

{

mReport = (
ReportDocument)Session["ReportDocument"];

}

mReport.ExportToHttpResponse( ExportFormatType.PortableDocFormat, Response, false,Session["ReportName"].ToString() );

}

catch ( Exception ex )

{

string lMessage = ex.Message.Replace( "\n", "\\n" ).Replace( "'", "''" ).Replace( "\r", "\\r" );

Page.ClientScript.RegisterClientScriptBlock( GetType(), DateTime.Now.Ticks.ToString(),

"alert('" + lMessage + "')", true );

}

finally

{

if ( mReport != null )

{

mReport.Close();

mReport =
null;

}

}

}

//End of code

Charles
0
CharlesJC
10/15/2007 6:15:27 PM
asp.net.crystal-reports 7043 articles. 0 followers. Follow

0 Replies
1174 Views

Similar Articles

[PageSpeed] 14

Reply:

Similar Artilces:

Convert my reports from "Active Reports" to "Crystal Reports"
Hello, I discovered data dynamics active reports product a year ago while I was starting a new asp.net project and decided to use it as the reporting tool, it's a very nice product and have a lot of advantages over many other products in the market. However...I also discovered that although they clearly declare that they support Right To Left languages, they have a BIG issue when using Right To Left languages in ASP.NET.I've been writing them posts about this problem and asking when they are going to fix it for 8 months, and yet they did not give me an estimate time frame for fixing this i...

Error found "Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied. "
Hi guys! i'm trying to solve the error "Err Msg: "Object reference not set to an instance of an object" in ASP.NET app" but when i followed the instructions in the http://community.crystaldecisions.com/library/kbase/articles/c2011144.asp link, this error appeared ""Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied. " What's going on? i already went to the iis to add new virtual directory (CrystalReportWebFormViewer) but different error appeared when i compile and browse my application. pls help ...

Converting Crystal Reports 9 report to Crystal Reports .NET report
I have a web page that is supposed to display a crystal report.  The report is fully written and functional in crystal 9 (non-.Net)  .  Is there a way to convert my .rpt so that I can just include it in the new web site? why you don't try to compile project with .net and include your report. then if crystal report is power tool will suggests you with conversation tool    My blog is here.Please remember to 'Mark as Answer' if this post answered your question! Wow it really was that easy!  I just added the old crystal report into my .NET proj...

Crystal Report give error "Load Report Failed"
Helloi in my Project I m using Crystal report,My Crystal report is Export in PDFi Have 150 fileapplication is first file export in pdf,then second file export pdf,in same say may be 30-40 file export in pdfbut after they give error load report faild, why this error will come.for run that application agian i have closed my VS and start again applicationwhy this will happen?  Nothing is really over,untill the moment stop trying for it...Amitsp(MCTS,MCP)sqlreporting.blogspot.com...

"Load Report Failed."
Hi Everyone, I have developed a report in VS2005 (On a Vista PC, in case that's relevant). In the report designer, I switch to "Main Report Preview" and the report shows up fine - it get the data from the database and displays perfectly. I tried to add a page to display the report in my app.  I added a crystal report viewer and a Crystal Report Source.  The report displays fine in design view.  However, when I run the app, all I get is "Load Report Failed". Please see the code below:<%@ Page Language="C#" M...

"Logon failed error on Crystal Reports" when using oracle at backend and crystal reports
I am using VS.NET 2003 and oracle 8i database at backend. When I connect DB by ADO it connects and show tables and after making the report when I try to view it in browser there is an error of Logon failure on crystal reports. I am using VB.NET and ASP.NET. Kindly reply me soon. All in all I want to show reports in crystal reports from oracle 8i database. Haroon. can you post your code where you load the report--------------------------------------------------Sincerely,Michael ReyerosPlease remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if...

Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Access to the path "C:\Program Files\Microsoft Visual Studio .NET\Crystal Reports\Viewers" is denied. The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the...

Crystal Reports VS.NET 2005 "Invalid Keycode"
I am creating a new ASP.NET web site and dropping a CrystalReportViewer on it in VS.NET 2005.  I create a report source, I create a new report and when I choose ok, it tries to open the report to design it and I get an "Invalid Keycode" message.I found the information on the VS.NET 2002 and 2003 registry keys, but they don't exist in VS.NET 2005 of course, so that didn't help.I've gone through the repair option on the DVD, and verified that the Crystal Report section is all selected, but that hasn't helped.Does anyone know how to solve this provblem?T...

Crystal Report, Report "Flashes" on screen, then disapers when Priviewed
I am using the Crystal Report Automation Service to preview CR reports from my PowerBuilder application. When I call the Preview function, the report "flashes" on the screen, then it disapers right away. How can I make it "stay" untill the user closes the Preview Window ? OLEObject sc1, loo_Report sc1 = CREATE OLEObject li_return = sc1.ConnectToNewObject ("crystal.crpe.application") loo_Report = sc1.OpenReport( ls_FullFileName) loo_Report.PrintWindowOptions.CanDRillDown = TRUE loo_Report.PrintWindowOptions.HasCancelButton = TRUE loo_Report.PrintWind...

"Using other editions of SQL Server for report data sources and/or the report server database" is not supported in this edition of Reporting Services
Hi My project is in .NET 2003 i.e. framework 1.1 and database in SQLServer 2000. But the reports have been developed using SQLServer 2005 Reporting Services. Now when I am trying to deploy them through deployment project of .NET its giving me following error:"Using other editions of SQL Server for report data sources and/or the report server database" is not supported in this edition of Reporting Services.  Now I am really confused with this. Can any one please guide me regarding this ASAP. Thanks, Falguni    You will need to use the SQL Server ...

crystal reports .net -> crystal reports .net 2003
recently converted a project from .net to .net 2003. The 2 crystal reports I had in the project do not load when executing the application. The project itself within 2003 will allow me to multiplat the crystal reports, however when it comes to execution time I get the error: Invalid Data Source. If this isn't the right forum please point me to the right one as this is really the only website I know of with a large reader base. >to multiplat the crystal reports To what the crystal reports? Do you have the same database connections established and verified in your 2003 s...

Not cleaning tmp file of crystal report on deployment server (error load report failed)
Hello frnds, I am displaying report using crystal report 10.5. On local server, it cleans the tmp file which is created in Temp system folder but after publishing on deployment server, it does not clean the tmp file. It runs for some time very well, but after when temp folder is full of tmp file of crystal report. It return error, "load report failed". When i clean temp folder on server, It runs once again very well for sometime. So, please tell me the solution. Here is my codeReportDocument myReportDocument;private void BindCrystalReportMTAF() { try {DataSet ds = new DataS...

Urgent, Not cleaning tmp file of crystal report on deployment server(error : load report failed)
Hello frnds, I am displaying report using crystal report 10.5. On local server, it cleans the tmp file which is created in Temp system folder but after publishing on deployment server, it does not clean the tmp file. It runs for some time very well, but after when temp folder is full of tmp file of crystal report. It return error, "load report failed". When i clean temp folder on server, It runs once again very well for sometime. So, please tell me the solution. Here is my code ReportDocument myReportDocument;private void BindCrystalReportMTAF() { try { DataSet ds = new Dat...

Crystal Report
I'm trying to get a Crystals Report to show up using Win .Net 2003 server and I keep getting this error: (note: it works fine with my other server running win2k server) Access to the path "dynamic_images" is denied It sounds like a typical "ASP.NET is not authorized to access the requested resource." But none of the following actions resulted in getting past it: 1.) I added ASPNET to the Administrators group 2.) I added ASPNET user with full control to the following folder and its children C:\Program Files\Microsoft Visual Studio .NET\Crystal ...

Web resources about - Crystal Reports for VS2005 ExportToHTTPResponse gives "Invalid report file path" on deployed server - asp.net.crystal-reports

Resources last updated: 1/8/2016 4:22:07 AM