dashboard-119166-web-dashboard-integrate-dashboard-component-dashboard-backend-server-side-configuration-aspnet-mvc.md
This article assumes that you implement a client-server architecture. An ASP.NET Core or an ASP.NET MVC application serves as the backend (server side). The client (frontend) application includes all the necessary styles, scripts and HTML-templates. Note that client scripts, libraries on the server side, and devexpress npm packages should have matching version numbers.
This document describes how to create and configure an ASP.NET MVC application as a server-side solution.
Add a new empty DefaultDashboard controller to the project’s Controllers folder and inherit the DashboardController class:
using DevExpress.DashboardWeb.Mvc;
namespace MvcCustomController {
public class DefaultDashboardController : DashboardController {
}
}
Imports DevExpress.DashboardWeb.Mvc
Namespace MvcCustomController
Public Class DefaultDashboardController
Inherits DashboardController
End Class
End Namespace
You can also derive a custom dashboard controller from RestrictedDashboardController to prevent inadvertent or unauthorized dashboard modifications and protect dashboards stored on a server.
In the DashboardConfig.cs file, call the RouteCollectionExtension.MapDashboardRoute method and pass the prefix to allow the HTML JavaScript Dashboard control to interact with the ASP.NET MVC backend:
using DevExpress.DashboardWeb.Mvc;
// ...
public static void RegisterRoutes(RouteCollection routes) {
routes.MapDashboardRoute("api/dashboard", "DefaultDashboard");
// ...
}
Imports DevExpress.DashboardWeb.Mvc
' ...
Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapDashboardRoute("api/dashboard", "DefaultDashboard")
' ...
End Sub
The api/dashboard prefix in the MapDashboardRoute method is used as a part of URL when you set the DashboardControlOptions.endpoint property on the client.
You need to configure corresponding permissions to access the HTML JavaScript Dashboard from a server at a different origin. See Cross-Origin Resource Sharing for information on how to set up cross-origin resource sharing (CORS) on your backend.
Set up the DashboardConfigurator that defines dashboard storage, data source storage, and connection strings provider. Use the following approaches to supply the server with data:
Refer to the following topics for information how to create a client-side Web Dashboard application:
See Also
Server-Side Configuration (ASP.NET Core)
Add a Web Dashboard to an Angular CLI Application