0

I'm developing a web application using asp.net c#. I have a designed a crystal report that will get billing details from the database once a user purchases an item from the web application.

Everything is working fine in my local system. But as soon as I uploaded my publish folder to my shared hosting area I'm facing this error.

System.Runtime.InteropServices.COMException: Invalid file name.

Below is the code that I have returned in my .cs file

generatereport(6,Server.MapPath("~/CustomerPurchaseBill.rpt");

public void generatereport(int trid, string filepath)
{
        ReportTableAdapters.ReporttblAdap dp = new ReportTableAdapters.ReporttblAdap();
        ReportDocument rdc = new ReportDocument();
        DataTable tb = new DataTable();
        tb = dp.GetData(trid);            
        rdc.Load(filepath);
        rdc.SetDataSource(tb);
        rdc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport");
        //CrystalReportViewer2.ReportSource = rdc; 
}
Roham Rafii
  • 2,929
  • 7
  • 35
  • 49
  • This post may help you http://stackoverflow.com/questions/12959845/crystal-report-fails-to-load-when-application-is-deployed-in-iis – Keerthi Kumar Mar 11 '15 at 07:44
  • hi i checked the link that u have suggested and try to make the changes which are suggested in the link but still my error is same after publishing. – Musaddiq Quereshi Mar 11 '15 at 12:10
  • It seems to be some permission issue Try giving everyone full access to the windows temp directory. May solve your problem. – Keerthi Kumar Mar 13 '15 at 04:34

0 Answers0