New to Telerik ReportingStart a free 30-day trial

Building Connection String for Column Encrypted Key

Description

I created a report in Telerik Reporting with a column that uses a Column Encryption Key. Using the Column Encryption Setting=Enabled connection string, I successfully displayed the encrypted column in the Telerik Report Designer. However, when I applied the same connection string in an ASP.NET Core application's appsettings.json, an error occurred.

Error Message

error
Unable to get report parameters. Unable to establish a connection to the database. Please verify that your connection string is valid. In case you use a named connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application.

Solution

  1. Install the Microsoft.Data.SqlClient NuGet package, which is required for Always Encrypted support in Telerik Reporting:

    bash
    dotnet add package Microsoft.Data.SqlClient
  2. Update the appsettings.json configuration to use the Microsoft.Data.SqlClient data provider:

    json
    "CONNECTION_ALIAS": {
        "connectionString": "Data source=localhost;initial catalog=XXXX;User ID=XXXXX; Password=XXXXXXX; MultipleActiveResultSets=true;MultiSubnetFailover=False;Encrypt=False;Column Encryption Setting=Enabled;",
        "providerName": "Microsoft.Data.SqlClient"
    }

    Adding Encrypt=False to the connection string may be necessary depending on your SQL Server setup.

    Run the application and verify that the Telerik Reporting displays the encrypted columns correctly.

See Also