Dundas BI Viewer Integration Sample
This article shows how to build and run the Dundas BI Viewer Integration Sample (for Visual Studio 2013 or above). The sample demonstrates how to integrate the viewer into an existing application. This sample makes use of a POST /LogOn/Token/ call in the Dundas BI REST API.
The sample demonstrates how to use an iframe to embed the viewer. The sample demonstrates how to use an embedded viewer. This sample demonstrates how to use an integrated viewer. This sample demonstrates how to insert an integrated viewer.
To download the Viewer Integration Sample solution click here.
The following prerequisites must be installed on your computer:
- Visual Studio 2013, or higher.
- Microsoft .NET Framework 4.5
- IIS web server running ASP.NET 2.0 or greater
- Dundas BI Server
3.2. Add a local user account
In order 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:
- Username: viewer
- Password: 1234
- Seat Type: Standard user with option "Is seat reserved" selected.
See the article on Add an Account for more details.
3.3. Obtain the ID of a dashboard for viewing
To obtain a dashboard ID do the following:
Login to your Dundas BI Server, and click on the Admin button.
Find the dashboard that you wish to use, right click, then select properties.
Find the ID in the Properties Panel.
3.4. Sample solution
Attached to this article is the DundasBIViewerIntegrationSamples.zip. Download this file, and extract to a directory of your choosing. In this directory, find the file named DundasBIViewerIntegrationSamples.sln and double-click.
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:
3.5. Update Constants.cs
In the NetViewerIntegrationSample project, edit the Constants.cs file. There are five constants which 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:
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:
- It may be necessary to enable cross-origin resource sharing. Click here for more information.
- The URL path is case sensitive when referring to a virtual directory on the IIS.