New to Telerik Reporting? Download free 30-day trial

Constructing a Connection String to the Reporting Engine

When using WinForms or WPF Report Viewer, its connection to a Report Server or REST service instance should be additionally set. This topic lists the supported keywords for each report engine type and explains how to construct a connection string with or without using helper classes.

All the keywords and their values are case insensitive where applicable.

Embedded Report Engine

Keyword Value
Engine Embedded

Example: engine=embedded

You can use a EmbeddedConnectionInfo instance to help you create the connection string or leave it empty - the viewer will use the embedded report engine by default.

private void SetEmbeddedReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.EmbeddedConnectionInfo().ConnectionString;
    //if the ReportEngineConnection property is set to null or empty string, it will use the EmbeddedConnectionInfo by default.
}
Private Sub SetEmbeddedReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.EmbeddedConnectionInfo().ConnectionString
    'if the ReportEngineConnection property is set to null or empty string, it will use the EmbeddedReportEngineConnectionInfo by default.
End Sub

Report Server Engine

Keyword Value
Engine ReportServer
Uri required; The URI of the Report Server instance
Username optional; The user name used to connect to Report Server. If omitted, the Guest account will be used, if it is enabled.
Password optional; The password associated with the user name.
Timeout optional; The timeout for rendering a document measured in seconds. The default value is 100 seconds. Value of 0 indicates no expiration.
KeepClientAlive optional True/False. Sets whether the client will be kept alive. When set to true expiration of the client will be prevented by continually sending a request to the server, determined by the Reporting REST service's ClientSessionTimeout. The default value is True.

Example: engine=ReportServer;uri=http://localhost:83;username=admin;password=pass;timeout=30;keepClientAlive=true

You can use a ReportServerConnectionInfo instance to help you create the connection string.

private void SetReportServerReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.ReportServerConnectionInfo("http://reportserver:83", "user", "pass", 20).ConnectionString;
}
Private Sub SetReportServerReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.ReportServerConnectionInfo("http://reportserver:83", "user", "pass", 20).ConnectionString
End Sub

REST Service Engine

Keyword Value
Engine RestService
Uri required; The URI of the REST Service instance.
Token optional; If provided, a Bearer token will be set in the Authorization header for every request to the REST service.
UseDefaultCredentials optional, True/False; If provided, the client will send the default credentials with its requests. The default value is False.
Timeout optional; The timeout for rendering a document measured in seconds. The default value is 100 seconds. Value of 0 indicates no expiration.
KeepClientAlive optional True/False. Sets whether the client will be kept alive. When set to true expiration of the client will be prevented by continually sending a request to the server, determined by the Reporting REST service's ClientSessionTimeout. The default value is True.

Example: engine=RestService;uri=http://localhost:18103/api/reports;token=authToken;useDefaultCredentials=true;timeout=30;keepClientAlive=true

You can use a RestServiceConnectionInfo instance to help you create the connection string.

private void SetRestServiceReportEngineConnection(object sender, System.EventArgs e)
{
    this.reportViewer1.ReportEngineConnection = new Telerik.ReportViewer.Common.RestServiceConnectionInfo("http://servicehost:83/api/reports", "authToken", 20).ConnectionString;
}
Private Sub SetRestServiceReportEngineConnection(sender As Object, e As System.EventArgs)
    Me.ReportViewer1.ReportEngineConnection = New Telerik.ReportViewer.Common.RestServiceConnectionInfo("http://servicehost:83/api/reports", "authToken", 20).ConnectionString
End Sub

See Also

In this article