Telerik Forums
Reporting Forum
1 answer
134 views
Hello, I'm new to web development, and I'm currently facing an issue with viewing reports on my website when it's uploaded to the server using IIS. The problem is that sometimes I can't view the Report Viewer, but other times I can. When I can't view it, I get this error message: "Error registering the viewer with the service. An error has occurred. Access to the path is denied." Where should I start checking for this issue?
Dimitar
Telerik team
 answered on 05 Oct 2023
1 answer
52 views

I'm trying to implement the REST Custom Report Source Resolver in a .net core web api. But the reports are not showing even the URL is not working. I have used a middleware to connect this to the application. Bellow you can see the regarding. cods.

 

middleware class

public class TelerikReportingMiddleware
    {
        private readonly RequestDelegate _next;

        public TelerikReportingMiddleware(RequestDelegate next)
        {
            _next = next;
        }

        public async Task Invoke(HttpContext context, IAPIService aPIService)
        {
            string[] path = !string.IsNullOrEmpty(context.Request.Path.Value) ? context.Request.Path.Value.Split("/") : new string[4];

            if (path.Length > 2 && path[2] != null && path[2].Equals("telerikreports", StringComparison.CurrentCultureIgnoreCase))
            {
                if (context.Request.RouteValues["controller"] == null)
                {
                    context.Request.RouteValues["controller"] = path[2];
                }
                if (context.Request.RouteValues["action"] == null)
                {
                    context.Request.RouteValues["action"] = path[3];
                }

                if (!context.Request.Headers.ContainsKey("IntegrationID"))
                {
                    var appId = "1";
                    context.Request.Headers.Add("IntegrationID", appId);
                }
            }

            await _next(context);
        }

        private async Task ReturnErrorResponse(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
            await context.Response.WriteAsJsonAsync("Bad Request: Integration Not Defined, " +
                "Request ID Sould be defined in the Header section of the request");
        }
    }

 

Report Resolver class

 

public class BLReportResolver : IReportResolver
    {
        private readonly string _serverPath;

        public BLReportResolver()
        {
            _serverPath = Path.Combine(Directory.GetCurrentDirectory(), "TelerikReports");
        }

        public ReportSource Resolve(string reportId)
        {
            try
            {
                /* get path to report */
                var sourceReportSource = new UriReportSource { Uri = Path.Combine(_serverPath, reportId) };

                //retrieve an instance of the report     
                var reportPackager = new ReportPackager();
                using (var sourceStream = File.OpenRead(sourceReportSource.Uri))
                {
                    var report = (Report)reportPackager.UnpackageDocument(sourceStream);

                    var reportInstance = new InstanceReportSource
                    {
                        ReportDocument = report
                    };

                    return new InstanceReportSource { ReportDocument = reportInstance.ReportDocument };
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return null;
            }
        }
    }

 

controller class

 

[Route("api/[controller]")]
    [ApiController]
    public class TelerikReportsController : ReportsControllerBase
    {

        static readonly ReportServiceConfiguration configurationInstance =
            new ReportServiceConfiguration
            {
                HostAppId = "TelerikRESTReports",
                Storage = new FileStorage(),
                ReportResolver = new BLReportResolver(),
                ReportSourceResolver = new UriReportSourceResolver(Path.GetFullPath("~/TelerikReports"))
            };

        public TelerikReportsController()
        {
            this.ReportServiceConfiguration = configurationInstance;

        }
    }

 

what can be the issue?

        
0 answers
217 views

After upgrading the Telerik Report to version 1021, the report viewer is unable load properly.

In the console, I'm getting an error: Failed to load resource: the server responded with a status of 404 (Not Found) ... http://localhost:8080/api/reportservice/resources/js/telerikReportViewer-14.2.20.1021.min.js

Is this because of the Telerik Reporting REST API not properly hosted?

How should I fix this issue?

Thanks!

0 answers
109 views

Hi Team ,

After updating version of Telerik assemblies, Itemdatabound event[I have attached one screenshot for reference (its written in .vb file)]  is getting called while creating report as well while printing report. but I don't want it to get called while I am printing report. Is there any way that I can set autopostback(in telerik report) to false in telerik report ? Or any other solution will be appreciated to call Itemdatabound event only while creating report and not while printing.

Anyone can help me ? 

Kind regards, 

Payal

0 answers
326 views

Hi All, 
I need display Telerik report inside a razor page in the .NET framework MVC app.

I attached the design I need to build. 
Top of the razor page I'm selecting parameter values for stored procedure. Based on that values report will show the details.
I tried html5 reports and mvc reports. But those are not helped to do my requirement

If anyone is having suggestion, resources or ideas, please insert here. It would be much helpful for me

Thank you

Mail
Top achievements
Rank 1
 updated question on 24 Jan 2022
1 answer
713 views

Hi,

I have a problem when I  try to print report in controller. The thing is; it is working locally but when I deploy the project to iss I am getting error message says; "System.InvalidOperationException: No or invalid printer error on IIS server."


// Obtain the settings of the default printer
                System.Drawing.Printing.PrinterSettings printerSettings
                    = new System.Drawing.Printing.PrinterSettings();

                // The standard print controller comes with no UI
                System.Drawing.Printing.PrintController standardPrintController =
                    new System.Drawing.Printing.StandardPrintController();

                // Print the report using the custom print controller
                Telerik.Reporting.Processing.ReportProcessor reportProcessor
                    = new Telerik.Reporting.Processing.ReportProcessor();

                reportProcessor.PrintController = standardPrintController;

                    Telerik.Reporting.TypeReportSource typeReportSource =
                        new Telerik.Reporting.TypeReportSource();

                    //// reportName is the Assembly Qualified Name of the report
                    //typeReportSource.TypeName = reportName;

                // Create a new report source pointing to report definition
                var reportSource = new UriReportSource();
                reportSource.Uri = entity.ReportName;



                foreach (var i in entity.Parameters)
                {
                    reportSource.Parameters.Add(new Parameter(i.Key, i.Value));
                }


                    reportProcessor.PrintReport(reportSource, printerSettings);                    

                return null;

 

Please suggest,

Thanks

0 answers
102 views

Hey all, I built my SQL query elsewhere and want to pass parameters to it with @param style. I inserted it in "Select Statement" window and created parameters in reporting with values, yet it doesnt map. If I do it with built-in query builder, it maps and works, simply because in next page it allows you to put the parameter location like @param will be equal to '= Parameters.slevel.Value'

But I can't use built-in query builder in this project, how can I make this work?

Thanks!

 

Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?