Dundas BI viewer integration sample


1. Overview

This article shows how to build and run a sample web application that embeds Dundas BI using server-side code with the help of the Dundas BI embed library. In this example, users are logged in to view a particular dashboard.

This sample makes use of a POST /LogOn/Token/ call in the Dundas BI REST API to get a logon token at the server, which allows you to keep your logon credentials secure. See Using the Dundas BI embed library for more information on logging on to Dundas BI when embedding.

2. Download

To download the viewer integration sample solution, click here.

3. Setup

3.1. Prerequisites

The following must be installed on your computer:

  • Visual Studio 2015, or higher
  • Microsoft .NET Framework 4.6.1
  • IIS web server running ASP.NET 2.0 or greater
  • A deployed Dundas BI instance

3.2. Add a local user account

For the sample to work, it needs to log in to your Dundas BI server via a specific local user account that has privileges to view dashboards. The sample code is actually hard-coded with an expected local user name and password. You can change these credentials in the code (as will be shown later), or log in to Dundas BI as an administrator and create the expected local user account as follows:

  • Name: viewer
  • Password: 1234
  • Seat Type: Standard user
  • Seat Mode: Reserved

See the article on Accounts for more details.

3.3. Obtain the ID of a dashboard for viewing

You will need the file ID of the dashboard (or other view) you want to load.

Find your file in the Explore window, in the open dialog found in the main menu, or in the Admin section's File Explorer.

Right-click and select Properties.

Dashboard properties
Dashboard properties

Find the ID listed in the Properties dialog. You can select and copy it using Ctrl-C.

Getting the dashboard ID
Getting the dashboard ID

3.4. Sample solution

After downloading the solution .zip file, extract it to a folder of your choice, and open the file named DundasBIViewerIntegrationSamples.sln in Visual Studio. Make sure the user account has the appropriate permissions to access this folder.

Within Visual Studio, you can see that the solution consists of one project:

  • NetViewerIntegrationSample

Viewer integration sample solution
Viewer integration sample solution

3.5. Update Constants.cs

In the NetViewerIntegrationSample project, edit the Constants.cs file. There are five constants that may need to be updated:

  • DundasBIServerUri - The URI of the Dundas BI server.
  • DundasBIViewerUsername - The username to use when logging in to Dundas BI (e.g., viewer).
  • DundasBIViewerPassword - The password corresponding to the username (e.g., 1234).
  • DundasBIDashboardId - The ID of the default dashboard to show (e.g., 7bcebd59-d425-4f29-9ea4-73033d50d515).
  • ViewOptions - The view options are listed below:
    • none
    • viewonly
    • menuonly
    • menutoolbar
    • menutoolbartaskbar


4. Publish and test sample

You can now build and publish the NetViewerIntegrationSample project to your IIS server. For example, you may want to publish it to the default web site under a web application name such as: NetViewerIntegrationSample.

After publishing, test the sample by opening a new browser window and navigating to the URL for the sample. For example:


5. Notes

6. See also

Dundas Data Visualization, Inc.
400-15 Gervais Drive
Toronto, ON, Canada
M3C 1Y8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours:
Phone: 9am-6pm, ET, Mon-Fri
Email: 7am-6pm, ET, Mon-Fri