Accessing the ReportExecutionService.Render method when reporting service (2008 / R2) is in Forms based authentication (Using ReportingService.LogonUser method)
Recently was working on an interesting sample which will help you to render a report using the web service API where reporting service is in Forms Based Authentication (FBA). This code was tested with SSRS 2008 and SSRS 2008 R2 (KJ). The reason for publishing this code is, this is different from the conventional windows authentication.
1. First you need to make sure your Reporting Service installation is working fine with the FBA implementation.
2. Create a new ASP.NET web application project and add the references to the following web service end points,
ReportService2005.asmx (If you're using SSRS 2008 R2, please make sure to start using ReportService2010.asmx as ReportService 2005.asmx is deprecated) and ReportExecution2005.asmx.
3. Refer the following self explanatory code and use them in your reference. (Attached the full source code and the project with the
protected void Page_Load( object sender, EventArgs e)
RenderReport report = new RenderReport ();
byte  result = report.RenderReportToPDF();
//To display the PDF in web browser, set the right content type.
Response.ContentType = "Application/pdf" ;
//Write the byte array to the default output stream.
Response.OutputStream.Write(result, 0, result.Length);
/ /Flush the contents to be displayed in the browser.
public class RenderReport. ReportingService2005
//Change to point to your report.
private string ReportPath = "/Test" ;
private string m_authCookieName;
private Cookie m_authCookie;
// Set the server URL. You can pull this from a config file or what ever way you want to make it dynamic.
// The LogonUser method authenticates the specified user to the Report Server Web Service when custom authentication has been configured.
// This is to authenticate against the FBA code and then store the cookie for future reference.