Integrating the Dashboard Components in ASP.NET App
Our sample projects and report templates can help you learn the basics of working with our products.The Angular dashboard viewer can also be hosted by a classic ASP.NET MVC (.NET Framework) application, with a controller that allows cross-origin requests.
Serve the viewer with CORS enabled.
How it works. A .NET Framework MVC controller answers the Angular viewer's cross-origin requests, so legacy apps can serve modern Angular dashboards.
Serve the viewer with CORS enabled.
[AllowCrossSiteJson]
public ActionResult InitViewer()
{
var requestParams = StiMvcViewer.GetRequestParams();
var options = new StiAngularViewerOptions();
options.Actions.GetReport = "GetReport";
options.Actions.ViewerEvent = "ViewerEvent";
options.Toolbar.ShowDesignButton = true;
return StiAngularViewer.ViewerDataResult(requestParams, options);
}
[AllowCrossSiteJson]
public ActionResult GetReport()
{
var report = StiReport.CreateNewReport();
report.Load(Server.MapPath("~/Reports/HotelRevenue.mrt"));
return StiAngularViewer.GetReportResult(report);
}AllowCrossSiteJson— a custom action filter addingAccess-Control-Allow-Origin: *so the Angular app can call the API.StiAngularViewer.ViewerDataResult/GetReportResult— the same Angular integration API, here onSystem.Web.Mvc.
How it works. A .NET Framework MVC controller answers the Angular viewer's cross-origin requests, so legacy apps can serve modern Angular dashboards.