RadzenSSRSViewer displays a report created in SQL Server Reporting Services (SSRS).
To display a report you should specify:
<RadzenSSRSViewer ReportName="Untitled" ReportServer="http://myserver/ReportServer/" />
Often SSRS reports have parameters. You can specify those via the Parameters
collection:
<RadzenSSRSViewer ReportName="Untitled" ReportServer="http://myserver/ReportServer/">
<Parameters>
<RadzenSSRSViewerParameter ParameterName="Param1" Value="1" />
<RadzenSSRSViewerParameter ParameterName="Param2" Value="2" />
</Parameters>
</RadzenSSRSViewer>
Often your report server won't be exposed to the public Internet or you would want to either hide report parameters or provide security credentials. In this case you can use the built-in proxy support in RadzenSSRSViewer.
To enable it set the UseProxy
property to true
and add the ReportController
class below to your Blazor application.
<RadzenSSRSViewer UseProxy="true" ReportName="Untitled" ReportServer="http://myserver/ReportServer/">
<Parameters>
<RadzenSSRSViewerParameter ParameterName="Param1" Value="1" />
<RadzenSSRSViewerParameter ParameterName="Param2" Value="2" />
</Parameters>
</RadzenSSRSViewer>
To provide user credentials when making the proxy requests you can implement the OnHttpClientHandlerCreate partial method of ReportController.
ReportController.Credentials.cs
OnHttpClientHandlerCreate
partial method:
using System.Net;
using System.Text;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
public namespace YourAppNamespace.Controllers
{
public partial class ReportController
{
void OnHttpClientHandlerCreate(ref httpClientHandler);
{
httpClientHandler.Credentials = new NetworkCredential("username", "password", "domain");
}
}
}
Alternatively you can set the Credentials
property of httpClientHandler
directly in the CreateHttpClient
method of the
ReportController
class:
private HttpClient CreateHttpClient()
{
var httpClientHandler = new HttpClientHandler();
httpClientHandler.AllowAutoRedirect = true;
httpClientHandler.UseDefaultCredentials = true;
// Set the credentials
httpClientHandler.Credentials = new NetworkCredential("username", "password", "domain");
if (httpClientHandler.SupportsAutomaticDecompression)
{
httpClientHandler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
}
OnHttpClientHandlerCreate(ref httpClientHandler);
return new HttpClient(httpClientHandler);
}
In some setups authenticating the request like this could fail with exceptions such as:
HttpRequestException: Authentication failed because the connection could not be reused.
. If this happens check this forum threadSystem.ComponentModel.Win32Exception (0x80090302): The function requested is not supported
. If this happens check this forum threadRadzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.
Radzen Blazor Components, © 2018-2024 Radzen.
Source Code licensed under
MIT