Deploy ClientUI Report Application Separately from Report Server

Today I start to create a simple Silverlight project that uses Intersoft SqlReportViewer. This project will be used to display Microsoft SQL Server 2008 Reporting Services (further abbreviated as SSRS) document. The objective is to create SqlReportViewer application where the SSRS is located in different server.

The first step begins with creating a new project using Intersoft ClientUI MVVM Application project template.

ProjectTemplate

After the project creation completed, you need to configure SqlReportViewer at first. Specifically, the following tasks are required in order to start using SqlReportViewer in your application:

  • Register the SqlReportViewer rendering engine in SQL Reporting Services.
  • Register the SqlReportViewer handler and SQL Reporting Services web service in the web project.
  • Set the SqlReportViewer proxy and web service property.

For more information on how to configure SqlReportViewer for first time use, it is suggested to check ClientUI documentation, Walkthrough: Configuring SqlReportViewer for First Time Use.

As you may see on the XAML code, the ReportProxyHandler and the ReportServer properties are set to different location of server. The project will be deployed on the deployment server, Saturn-PC. There will be another server, Uranus-PC, which will act as the SSRS server.

For this kind of scenario, you need to create a custom SqlReportViewer handler. The reason is because by default, the Intersoft SqlReportViewer handler uses Impersonate as the TokenImpersonationLevel. This means that the server process can impersonate the client’s security context on its local system. The server cannot impersonate the client on remote server.

The screenshot below shows what will happen when we use the default SqlReportViewer handler.

Exception

The impersonation level and network credential are handled by the SqlReportViewer handler. We need to add a class which inherits SqlReportViewerHandler, then set the ImpersonationLevel and NetworkCredential to the proper value.

Open the project and add a class library project, named as ExtendedSqlReportServer.

AddExtendedClass

Add the following code into the Class1.cs file.

As seen in the code above, the ImpersonationLevel property is overridden to return TokenImpersonationLevel.None, while the WindowClientCredential property is overriden to return the NetworkCredential object with proper user credential who has sufficient security permission to access the SSRS server. Of course, you should encrypt or obfuscate your code for the best security, especially when it contains security sensitive information.

After building the ExtendedSqlReportServer project, add the ExtendedSqlReportServer assembly file as References into the Web project. Finally, you redefine the SqlReportViewer handler using the new handler assembly.

In this post, you have learnt how to configure SqlReportViewer where the SqlReport service is deployed on remote server.

Should you find this post useful, or have any questions or feedback, please feel free to drop me a line in the comment box.

Best Regards,
Yudi Ariawan

Comments

Leave a Reply