I have a web application that will take in user data and go to a sql server database run the query, create a dataset from the query, and then create a report from that data. On my development machine with VS 2005 running winXP it works fine. However on
the win server 2003 machine it does not. I am loading the report using the Crystalreport.LOAD(server.mappath.("~/Filename.rpt")). Like i said it works on my development machine however on the server it gives me this error screen:
Server Error in '/' Application.
Invalid file name.
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.
Line 37: Private Sub ConfigureCrystalReports()
Line 38: Dim rptA As ReportDocument = New ReportDocument()
Line 39: rptA.Load(Server.MapPath("") & "\FormA.rpt")
Line 40: Dim rptds As DataSet = ReportADSXconfig.ReportADataSet(PreviousPage.PatientID, PreviousPage.Doctor, PreviousPage.Start, PreviousPage.EndDte, Page.User.Identity.Name)
Line 41: rptA.SetDataSource(rptds)
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
I would like to know how to fix this error so that it will run on my server. I have used the merge modules to run this. could that be the problem do i need to install the crystal reports server on the windows server. Just wondering if that could be the
issue. thanks for any help you can give
Are you sure that the file is there? c:/inetpub/website/FormA.rpt
And do you have all properties to load the file? Remember if you are using IIS, maybe is running with a user that does not have properties in the directory website. Can you move it somewhere else to test it?
You don't need @ in VB is only C# I believe as \ character is an escape character
I have a similar error but for a different reason. To help you, I suggest avoid using files. If you have a strongly typed Crystal Report, or can make one, this code will render it on the fly and send it to the client without creating a file.
This works in my development enviornment and doesn't use files. I have a different problem on my target machine that causes it not to work. But I haven't given up. Anyone know why a target machine with the framework and using the code above will give
me a Load Report Failure. I think it's a crystal dll somewhere. It's a windows 2000 server.
Crystal ReportShow Crystal reportCrystal to PDF ASP.NET 1.1
I have a same problem. When I checked Server.MapPath ("~ report / crystalreport.rpt"), it returns
D:\domains\storemanager.com\reports\crystalreport.rpt. The file still exists. I think the problem is in
storemanager.com. because it have a dot. features it should have been misunderstood as
storemanager.com file How do you solve this problem? Thanks!
Member
3 Points
53 Posts
crystal report load error
Nov 15, 2006 12:58 PM|regwood79|LINK
Hi everyone:
I have a web application that will take in user data and go to a sql server database run the query, create a dataset from the query, and then create a report from that data. On my development machine with VS 2005 running winXP it works fine. However on the win server 2003 machine it does not. I am loading the report using the Crystalreport.LOAD(server.mappath.("~/Filename.rpt")). Like i said it works on my development machine however on the server it gives me this error screen:
Server Error in '/' Application.
Invalid file name.
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.Runtime.InteropServices.COMException: Invalid file name.
Source Error:
Source File: C:\Inetpub\WebSite1\ReportA.aspx.vb Line: 39
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
I would like to know how to fix this error so that it will run on my server. I have used the merge modules to run this. could that be the problem do i need to install the crystal reports server on the windows server. Just wondering if that could be the issue. thanks for any help you can give
Contributor
5578 Points
3325 Posts
MVP
Re: crystal report load error
Nov 15, 2006 03:07 PM|albertpascual|LINK
Check the Server.MapPath("") I am sure is not returning the folder you want or where the file is
You should do this
string checkthivalue = Server.MapPath("") + @"\FormA.rpt"; //C#
rptA.Load(checkthisvalue);
Al
My Blog
Member
3 Points
53 Posts
Re: crystal report load error
Nov 15, 2006 03:13 PM|regwood79|LINK
I did check the string that it is returning:
it points to the directory which holds the report. c:/inetpub/website/FormA.rpt
does the @ symbol works for vb?
Contributor
5578 Points
3325 Posts
MVP
Re: crystal report load error
Nov 15, 2006 03:23 PM|albertpascual|LINK
Are you sure that the file is there? c:/inetpub/website/FormA.rpt
And do you have all properties to load the file? Remember if you are using IIS, maybe is running with a user that does not have properties in the directory website. Can you move it somewhere else to test it?
You don't need @ in VB is only C# I believe as \ character is an escape character
Al
My Blog
Member
3 Points
53 Posts
Re: crystal report load error
Nov 15, 2006 03:29 PM|regwood79|LINK
Contributor
5578 Points
3325 Posts
MVP
Re: crystal report load error
Nov 15, 2006 03:38 PM|albertpascual|LINK
Al
My Blog
Member
3 Points
53 Posts
Re: crystal report load error
Nov 15, 2006 03:42 PM|regwood79|LINK
I checked the string that the server.mappath shows it goes to the directory that holds the file it still gives the same error.
Then i moved the report to another folder on the server. Still gives an error now it say "INvalid Filename"
None
0 Points
1 Post
Re: crystal report load error
Nov 17, 2006 02:48 PM|pmmeyer1|LINK
I have a similar error but for a different reason. To help you, I suggest avoid using files. If you have a strongly typed Crystal Report, or can make one, this code will render it on the fly and send it to the client without creating a file.
MemoryStream oStream; // using System.IO
oStream = (MemoryStream)
report.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
This works in my development enviornment and doesn't use files. I have a different problem on my target machine that causes it not to work. But I haven't given up. Anyone know why a target machine with the framework and using the code above will give me a Load Report Failure. I think it's a crystal dll somewhere. It's a windows 2000 server.
Crystal Report Show Crystal report Crystal to PDF ASP.NET 1.1
None
0 Points
1 Post
Re: crystal report load error
Jul 12, 2012 12:25 AM|dinhtuvu|LINK
Hello!
I have a same problem. When I checked Server.MapPath ("~ report / crystalreport.rpt"), it returns D:\domains\storemanager.com\reports\crystalreport.rpt. The file still exists. I think the problem is in storemanager.com. because it have a dot. features it should have been misunderstood as storemanager.com file
How do you solve this problem?
Thanks!
Member
130 Points
45 Posts
Re: crystal report load error
Jul 18, 2012 12:09 AM|gnoix|LINK
in IIS -> ASP, please enable parent path
ASP.NET Hosting & Windows Hosting Expert