Dundas BI viewer integration sample
This article shows how to build and run a sample web application that directly embeds Dundas BI using an iframe and logs in to view a dashboard. This sample makes use of a POST /LogOn/Token/ call in the Dundas BI REST API.
To download the viewer integration sample solution, click here.
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.
Find the ID listed in the Properties dialog. You can select and copy it using Ctrl-C.
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:
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:
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. For more information about CORS, click here.
- The URL path is case sensitive when referring to a virtual directory on the IIS.