Current filter:
                                You should refresh the page.
                                  • Description:
                                    The Web Dashboard control passes information stored in the displayed Dashboard class from the server to the client side. The Dashboard class may contain full information about used data sources including connection parameters. This may happen in the following cases:

                                    1. The dashboard is created in the WinForms designer. In this case, even Login and Password may be saved if the DashboardDesigner.DataSourceWizardSettings.AlwaysSaveCredentials property is enabled.
                                    [XML]
                                    <Connection Name="localhost_NorthwindConnection" ProviderKey="MSSqlServer"> <Parameters> <Parameter Name="server" Value="localhost" /> <Parameter Name="database" Value="Northwind" /> <Parameter Name="useIntegratedSecurity" Value="True" /> <Parameter Name="read only" Value="1" /> <Parameter Name="generateConnectionHelper" Value="false" /> <Parameter Name="userid" Value="" /> <Parameter Name="password" Value="" /> </Parameters> </Connection>
                                    2. The data source is created in code and the connection parameters are added directly to the data source:
                                    Access97ConnectionParameters access97Params = new Access97ConnectionParameters();  
                                    access97Params.FileName = @"..\..\Data\nwind.mdb";  
                                    DashboardSqlDataSource sqlDataSource =  
                                        new DashboardSqlDataSource("SQL Data Source 1", access97Params);  
                                      
                                    

                                    For security reasons the Web Dashboard control automatically checks whether a Dashboard contains data connection parameters. In this case, the dashboard will not be loaded and the following error message will be displayed:

                                    An error has  occurred on an attempt to load the dashboard DashboardName
                                    The dashboard's data source 'DataSourceName'; has connection parameters that are passed to the client side as plain text. To allow passing connection parameters (for instance, user credentials), set the DashboardConfigurator.PassCredentials property to true. To learn how to protect confidential information, see  https://www.devexpress.com/Support/Center/Question/Details/T453795.

                                    Is it possible to avoid this problem and display data in the Web Dashboard without passing connection parameters to the client side?

                                    Answer:
                                    First of all, you can try displaying a dashboard by enabling the DashboardConfigurator.PassCredentials property. This property was introduced to prevent passing confidential information on the client side. This property is set to false  by default and causes a server-side exception if the dashboard XML definition contains user credentials. If this property is enabled, the dashboard should be displayed correctly. However, we do not recommend using this approach in production for security reasons.

                                    It is better to keep this property disabled and provide the connection parameters in a safe way. In this case, you will need to update the DataSource objects to remove all connection parameters and keep only a connection name. This example demonstrates how the connection should be defined in the XML file:

                                    [XML]
                                    <Connection Name="Northwind" FromAppConfig="true" />

                                    To remove connection parameters during dashboard loading, implement a custom Dashboard Storage as demonstrated in the following code snippet:

                                    [C#]
                                    CustomDashboardFileStorage dashboardStorage = new CustomDashboardFileStorage(Server.MapPath(@"~/App_Data/Dashboards")); // ASP.NET Web Forms approach: ASPxDashboard1.SetDashboardStorage(dashboardStorage); // Dashboard Configurator approach: //DashboardConfigurator.Default.SetDashboardStorage(newDashboardStorage); //CustomDashboardFileStorage.cs file: using System.Linq; //... public class CustomDashboardFileStorage : DashboardFileStorage { public CustomDashboardFileStorage(string workingDirectory) : base(workingDirectory) { } protected override XDocument LoadDashboard(string dashboardID) { Dashboard d = new Dashboard(); d.LoadFromXDocument(base.LoadDashboard(dashboardID)); d.DataSources.OfType<DashboardSqlDataSource>().ToList().ForEach(ds => { ds.ConnectionParameters = null; }); d.DataConnections.Clear(); return d.SaveToXDocument(); } }

                                    Then the connection parameters may be provided on the server side using one of the following approaches:

                                    - Add the required connection string to the connectionStrings section in the Web.config file.
                                    - Handle the ConfigureDataConnection event to provide the required connection parameters at runtime.
                                    - Create a provider of data connections by implementing the IDataSourceWizardConnectionStringsProvider interface and pass the created provider to the DashboardConfigurator.SetConnectionStringsProvider method.

                                • Paul Kubb 11.05.2018

                                  Thank you, it is working.

                                0 Solutions

                                Creation Date Importance Sort by