# Register Data Connections for Web Dashboard | Business Intelligence Dashboard | DevExpress Documentation

Register data connections to allow users to create data sources in the [Dashboard Data Source Wizard](/Dashboard/117680/web-dashboard/ui-elements-and-customization/dialogs-and-wizards/dashboard-data-source-wizard). To create a data connection, add a connection string to the configuration file or implement a custom data connection provider.

## Add a Connection String to the Configuration File

For security reasons, specify connection strings in the application’s configuration file (*appsettings.json* for ASP.NET Core and *Web.config* for ASP.NET MVC).

**ASP.NET Core**

```
{
    "ConnectionStrings": {
        "MS SQL Connection": "XpoProvider=MSSqlServer; data source=localhost; initial catalog=Northwind; Integrated Security=SSPI; Persist Security Info=True;",
        "XML Connection": "XpoProvider=InMemoryDataStore;Read Only=true;Data Source=Data\\nwind.xml;",
        "JSON Connection to URI": "uri=https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json",
        "MongoDB (local)": "mongodb://localhost:27017/"
    }
}
```

**ASP.NET MVC**

```
<configuration>
    <connectionStrings>
        <add name="MsSqlConnection" connectionString="XpoProvider=MSSqlServer; data source=localhost; initial catalog=Northwind; integrated security=SSPI;" />
        <add name="XmlConnection" connectionString="XpoProvider=InMemoryDataStore;Read Only=true;Data Source=Data\\nwind.xml;" />
        <add name="JsonConnection" connectionString="uri=https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json" />
        <add name="MongoDB (local)" connectionString="mongodb://localhost:27017/" />
    </connectionStrings>
</configuration>
```

The Web Dashboard control does not expose connection string names to the client. If a user creates a data source in the Data Source Wizard, the control throws an exception when it attempts to load connection strings. To resolve this behavior, call the [DashboardConfigurator.SetConnectionStringsProvider](/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.SetConnectionStringsProvider%28DevExpress.DataAccess.Web.IDataSourceWizardConnectionStringsProvider%29) method and pass the predefined connection strings provider instance.

Use the following providers based on the platform:

- [DashboardConnectionStringsProvider](/Dashboard/DevExpress.DashboardAspNetCore.DashboardConnectionStringsProvider) (ASP.NET Core)
- [ConfigFileConnectionStringsProvider](/CoreLibraries/DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider) (ASP.NET MVC)

The following code snippets use the default provider:

**ASP.NET Core**

```
using DevExpress.DashboardWeb;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
    DashboardConfigurator configurator = new DashboardConfigurator();
    // ...
    configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

    return configurator;
});

var app = builder.Build();
```

**ASP.NET MVC**

- C#
- VB.NET

<section id="tabpanel_NGV2AVmlnX_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code class="lang-csharp">DashboardConfigurator.Default.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());
</code></pre></section>
<section id="tabpanel_NGV2AVmlnX_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code class="lang-vb">DashboardConfigurator.Default.SetConnectionStringsProvider(New DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider())
</code></pre></section>

## Create a Custom Data Connection Strings Provider

Use the [DashboardConfigurator.SetConnectionStringsProvider](/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.SetConnectionStringsProvider%28DevExpress.DataAccess.Web.IDataSourceWizardConnectionStringsProvider%29) method to specify a data connection provider.

A custom data connection strings provider allows you to inject application-specific logic. Implement the [IDataSourceWizardConnectionStringsProvider](/CoreLibraries/DevExpress.DataAccess.Web.IDataSourceWizardConnectionStringsProvider) interface and pass the provider instance to the [SetConnectionStringsProvider](/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.SetConnectionStringsProvider%28DevExpress.DataAccess.Web.IDataSourceWizardConnectionStringsProvider%29) method.

The following example implements a custom connection strings provider.

- C#
- VB.NET

<section id="tabpanel_fcNYsIaob8_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.DataAccess.ConnectionParameters)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.DataAccess.ConnectionParameters&quot;,&quot;/ (DevExpress.DataAccess.Web)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.DataAccess.Web&quot;}" class="lang-csharp">using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Web;

// ...

public class MyDataSourceWizardConnectionStringsProvider : IDataSourceWizardConnectionStringsProvider {
    public Dictionary&lt;string, string&gt; GetConnectionDescriptions() {
        Dictionary&lt;string, string&gt; connections = new Dictionary&lt;string, string&gt;();

        // Customize the loaded connections list.  
        connections.Add(&quot;jsonUrlConnection&quot;, &quot;JSON URL Connection&quot;);
        connections.Add(&quot;msSqlConnection&quot;, &quot;MS SQL Connection&quot;);
        return connections;
    }

    public DataConnectionParametersBase GetDataConnectionParameters(string name) {
        // Return custom connection parameters for the custom connection.
        if (name == &quot;jsonUrlConnection&quot;) {
            return new JsonSourceConnectionParameters() { 
                JsonSource = new UriJsonSource(
                    new Uri(&quot;https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json&quot;)) 
                };
        } else if (name == &quot;msSqlConnection&quot;) { 
            return new MsSqlConnectionParameters(&quot;localhost&quot;, &quot;Northwind&quot;, &quot;&quot;, &quot;&quot;, MsSqlAuthorizationType.Windows);
        } 
        throw new System.Exception(&quot;The connection string is undefined.&quot;);
    }
}
</code></pre></section>
<section id="tabpanel_fcNYsIaob8_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.DataAccess.ConnectionParameters)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.DataAccess.ConnectionParameters&quot;,&quot;/ (DevExpress.DataAccess.Web)(?:;|$)/&quot;:&quot;/CoreLibraries/DevExpress.DataAccess.Web&quot;}" class="lang-vb">Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Web

&#39; ...

Public Class MyDataSourceWizardConnectionStringsProvider
    Implements IDataSourceWizardConnectionStringsProvider
    Public Function GetConnectionDescriptions() As Dictionary(Of String, String)
        Dim connections As New Dictionary(Of String, String)()

        &#39; Customize the loaded connections list.  
        connections.Add(&quot;jsonUrlConnection&quot;, &quot;JSON URL Connection&quot;)
        connections.Add(&quot;msSqlConnection&quot;, &quot;MS SQL Connection&quot;)
        Return connections
    End Function

    Public Function GetDataConnectionParameters(ByVal name As String) As DataConnectionParametersBase
        &#39; Return custom connection parameters for the custom connection.
        If name = &quot;jsonUrlConnection&quot; Then
            Return New JsonSourceConnectionParameters() With {.JsonSource = New UriJsonSource(New Uri(&quot;https://raw.githubusercontent.com/DevExpress-Examples/DataSources/master/JSON/customers.json&quot;))}
        ElseIf name = &quot;msSqlConnection&quot; Then
            Return New MsSqlConnectionParameters(&quot;localhost&quot;, &quot;Northwind&quot;, &quot;&quot;, &quot;&quot;, MsSqlAuthorizationType.Windows)
        End If
        Throw New System.Exception(&quot;The connection string is undefined.&quot;)
    End Function
End Class
</code></pre></section>

After you implement a custom connection strings provider, create its instance and pass it to the [DashboardConfigurator.SetConnectionStringsProvider](/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.SetConnectionStringsProvider%28DevExpress.DataAccess.Web.IDataSourceWizardConnectionStringsProvider%29) method:

**ASP.NET Core**

```
using DevExpress.DashboardWeb;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddDevExpressControls();
builder.Services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
    DashboardConfigurator configurator = new DashboardConfigurator();
    configurator.SetConnectionStringsProvider(new MyDataSourceWizardConnectionStringsProvider());
    // ...
    return configurator;
});

var app = builder.Build();
```

**ASP.NET MVC**

- C#
- VB.NET

<section id="tabpanel_NGV2AVmlnX-1_tabid-csharp" role="tabpanel" data-tab="tabid-csharp">
<pre><code data-code-links="{&quot;/ (DevExpress.DashboardWeb)(?:;|$)/&quot;:&quot;/Dashboard/DevExpress.DashboardWeb&quot;}" class="lang-csharp">using DevExpress.DashboardWeb;
// ...
public class Global : System.Web.HttpApplication {
    protected void Application_Start(object sender, EventArgs e) {
        // ...
        DashboardConfigurator.Default.SetConnectionStringsProvider(new MyDataSourceWizardConnectionStringsProvider());
    }
    // ...
}
</code></pre></section>
<section id="tabpanel_NGV2AVmlnX-1_tabid-vb" role="tabpanel" data-tab="tabid-vb" aria-hidden="true" hidden="hidden">
<pre><code data-code-links="{&quot;/ (DevExpress.DashboardWeb)(?:;|$)/&quot;:&quot;/Dashboard/DevExpress.DashboardWeb&quot;}" class="lang-vb">Imports DevExpress.DashboardWeb
&#39; ...
Public Class [Global]
    Inherits System.Web.HttpApplication
    Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        &#39; ...
        DashboardConfigurator.Default.SetConnectionStringsProvider(New MyDataSourceWizardConnectionStringsProvider())
    End Sub
    &#39; ...
End Class
</code></pre></section>

See the following help topic for more information: [Manage Multi-Tenancy](/Dashboard/402924/web-dashboard/integrate-dashboard-component/dashboard-backend/manage-multi-tenancy#manage-connection-string-access).

See Also

[Prepare Data Source Storage](/Dashboard/116482/web-dashboard/integrate-dashboard-component/dashboard-backend/prepare-data-source-storage)

[Custom Connection Strings for Data Sources](/Dashboard/117284/common-features/custom-connection-strings-for-data-sources)