Showing posts with label reportViewer. Show all posts
Showing posts with label reportViewer. Show all posts

Monday, March 15, 2010

Fix to Report viewer problems in IIS 7 or later

When we migrate web applications from IIS 6 to IIS 7 or IIS 7.5, we will face some problems in http handlers, mappings etc. I faced some problems with reportviewer control. So, below are all problems I have faced and solutions to them. And one more thing is, the server to which we migrated the application may or may not have all the report viewer dlls available in the system. If they didn't install then we need to install them. Otherwise you will get compilation error as we are using that in our application.

First of all, before proceed what are the dlls needed for the report viewer to run?
Microsoft.reportviewer.common.dll
Microsoft.reportviewer.processingobject.dll
Microsoft.reportviewer.webforms.dll
Microsoft.reportviewer.winforms.dll - For windows applications.

Friday, January 15, 2010

Report viewer control authentication – Part1 – Windows Authentication

Report viewer control, I think everyone knows what it is and how to use it. Today, I want to tell you how to authenticate the report viewer control in ASP.NET web application or windows application.

The report viewer control passing the credentials is same in both windows and web applications. How to pass windows credentials to the report viewer control?

  • Either you can set the <identity impersonation="true" /> or
  • You can directly pass the credentials object to the report viewer control as shown below. If default credentials then
    System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;ReportServerCredentials rsCredentials = serverReport.ReportServerCredentials; rsCredentials.NetworkCredentials = credentials;

    But, in some scenarios, you may need to pass the windows credentials dynamically instead of the logged in user credentials. Then it's the time to use NetworkCredentials object. Check below.

    ICredentials credentials = new NetworkCredential("User name", "Password", "Domain");

    Now, assign this credentials object to the report viewer credentials. So, I prefer to not directly give the credentials directly in the code. Instead add them in the web.config and access them in the code.

    I think, you understood it well. Love to hear comments.