RouteCollectionExtension.MapDashboardRoute(RouteCollection, String, String, String[], String) Method
Maps the specified URL route and sets a prefix, controller and area names, and namespaces.
Namespace: DevExpress.DashboardWeb.Mvc
Assembly: DevExpress.Dashboard.v24.1.Web.Mvc5.dll
NuGet Package: DevExpress.Web.Mvc5.Dashboard
Declaration
public static void MapDashboardRoute(
this RouteCollection routes,
string routePrefix,
string controllerName,
string[] namespaces,
string areaName
)
Parameters
Name | Type | Description |
---|---|---|
routes | RouteCollection | A collection of the RouteCollection objects that are routes for the application. |
routePrefix | String | A String value that specifies a route prefix. |
controllerName | String | A String value that specifies the controller name. |
namespaces | String[] | A set of namespaces for the application. |
areaName | String | A String value that specifies the name of the area to register. |
Remarks
A route prefix is used to handle requests from the client-side DashboardControl. Use the following properties in the client applications to specify the endpoint:
- Client app with DashboardControl: DashboardControlOptions.endpoint
- ASP.NET Core Razor app: DashboardBackendOptionsBuilder.Uri
- ASP.NET MVC Razor app: DashboardBackendOptions.Uri
When Web Dashboard is used within ASP.NET MVC Areas, you may encounter error messages like The dashboard "" is not found
. This message indicates that the ASP.NET MVC Routing is adjusted incorrectly and Web Dashboard requests are sent to the incorrect URL. In this case, use MapDashboardRoute
overload with the areaName
and namespaces
parameters:
using DevExpress.DashboardWeb.Mvc;
// ...
public static void RegisterRoutes(RouteCollection routes) {
routes.MapDashboardRoute("api/dashboard", "DefaultDashboard", new string[] { "DXWebApplication.Areas.Admin.Controllers" }, "Admin");
// ...
}