Problem when loading FRX file with FastReport Online Designer (MVC .NET Core)

edited April 2022 in FastReport .NET

Hi!

I'm trying to load a FRX file (is encrypted) and it's using MSSQL Connection.

My Code:

WebReport web = new WebReport(); // Create a Web Report Object
string webRootPath = _environment.WebRootPath; // Get the path to wwwroot folder
web.Width = "100%"; // Set the width of the report
web.Height = "1000"; // Set the height of the report
web.Report.Password = "xxxxxxx";
web.Report.Load(filePath); // Load the report into a web object
web.DesignerPath = "/designer/index.html";
web.Mode = WebReportMode.Designer;
web.DesignerSaveMethod = save;
try
{
    web.Report.Prepare();
}
catch(Exception e)
{
    Console.WriteLine(e.Message);
}
ViewBag.WebReport = web;

The error is:

FastReport.Utils.FileFormatException: Cannot load the file. Unknown file format
   at FastReport.Utils.XmlReader.RaiseException()
   at FastReport.Utils.XmlReader.ReadHeader()
   at FastReport.Utils.XmlReader.Read(XmlItem item)
   at FastReport.Utils.XmlDocument.Load(Stream stream)
   at FastReport.Web.WebReport.CutRestricted(String xmlString)
   at FastReport.Web.WebReport.DesignerGetReport()
   at FastReport.Web.Controllers.DesignerController.<.ctor>b__0_0()
   at FastReport.Web.Controllers.BaseController.<>c__DisplayClass19_0.<OnRequest>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at FastReport.Web.Controllers.BaseController.OnRequest(HttpContext httpContext)
   at FastReport.Web.FastReportMiddleware.RequestFastReportController(HttpContext httpContext)
   at FastReport.Web.FastReportMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)


HEADERS
=======
Accept: text/plain, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-US;q=0.7,lv;q=0.6,es;q=0.5,de;q=0.4
Connection: keep-alive
Cookie: _ga=GA1.1.465884617.1623827869; _ga_334KNG3DMQ=GS1.1.1623827869.1.1.1623828420.24; wp-settings-time-1=1638931878; .AspNetCore.Antiforgery.8HRHcM363BM=CfDJ8N50wnKuRbtHmqZJjF0cagqa5G_zoV9t491Xh5574p0fR2Y8k87oDmF2OuYwgnGbSjTUpc6SPj5o3Q1vbVaAvk3hSvlmPMfs_wRBx6JRNhQ5YRy4WzGdNQXnbzR52nEo7RHjZnpYCrvbUySP0GipVJs
Host: localhost:31107
Referer: http://localhost:31107/designer/index.html?uuid=5065a4998302425aa99c2bbcc47f0598
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Access-Control-Allow-Origin: *
sec-ch-ua-mobile: ?0
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"
sec-ch-ua-platform: "Windows"
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty


The image error is attached.

When the FRX file does not use MSSQL connection, it loads successfully. I don't know what i'm doing wrong.

Thanks.


Leave a Comment