Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net application with crystal report not working in shared hosting

I have a MVC application that uses crystal report. I have used the following code to download the report,

 ReportDocument rd = new ReportDocument();
 rd.Load(Path.Combine(Server.MapPath("~/Reports/" + Session["rpt"])));
 rd.SetDataSource(Session["result"]);
 Response.Buffer = false;
 Response.ClearContent();
 Response.ClearHeaders();
 //Excel
 Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
 stream.Seek(0, SeekOrigin.Begin);
 return File(stream, "application/vnd.ms-excel", "Cheque.xls");

Report downloading working fine in localhost. But when I have hosted this application in Godaddy's shared hosting, gives the following screen enter image description here

like image 693
Abhilash Ravindran C K Avatar asked Mar 08 '23 11:03

Abhilash Ravindran C K


1 Answers

Godaddy's shared hosting do not support Crystal report. Not only Godaddy's shared hosting but also most of the host provider's shared hosting do not support Crystal reports. To use Crystal report you have to purchase VPS or Dedicated Server.

If you want to run Crystal report on the server, it's always need the Crystal report runtime on that server. GoDaddy's shared hosting servers use the default Medium trust level that do not support the insatllation of Crystal report runtime.

Useful Information :

GoDaddy's shared hosting servers use the default Medium trust level with the addition of OleDbPermission, OdbcPermission, and a less-restrictive WebPermission.

Applications operating under a Medium trust level have no registry access, no access to the Windows event log, and cannot use reflection. Such applications can communicate only with a defined range of network addresses and file system access is limited to the application's virtual directory hierarchy. Please make sure that your application can work in a Medium trust environment if you are having any problems with it.

So people can use this as an indication of what shared hosting permissions are generally like.

One of the shared hosting that support Crystal Report is http://asphostportal.com. I am not sure about this. I got this information from other communities.

like image 173
Abhilash Ravindran C K Avatar answered May 01 '23 18:05

Abhilash Ravindran C K