Private Sub btnprint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnprint.Click
Dim rview As New Microsoft.Reporting.WebForms.ReportViewer()
Dim apr As New AppSettingsReader()
rview.ServerReport.ReportServerUrl = New Uri(apr.GetValue("ReportServer", GetType(String)))
Dim paramList As New System.Collections.Generic.List(Of Microsoft.Reporting.WebForms.ReportParameter)()
paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@DateServed", RadDatePick.SelectedDate))
paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@Location", ddlSch.SelectedValue))
paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@MenuType", ddlmenutype.SelectedValue))
rview.ServerReport.ReportPath = "/ReportFolder/ReportName"
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim deviceInfo As String = Nothing
Dim streamIds As String() = Nothing
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim format As String = "PDF"
deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"
Dim bytes As Byte() = rview.ServerReport.Render(format, deviceInfo, mimeType, encoding, extension, streamIds, warnings)
If format = "PDF" Then
Response.ContentType = "application/pdf"
Response.OutputStream.Write(bytes, 0, bytes.Length)
From MSDN[^]:Service Account Requirements for Reporting Services in a SharePoint deployment
Restrictions on using built-in accounts apply to some deployment topologies of Reporting Services that include a report server running in SharePoint integrated mode. The following combination of factors will result in service account requirements:
* Report Server is integrated with a SharePoint farm comprising more than one computer.
* The report server and SharePoint Central Administration web site run on separate computers.
In this scenario, if the Report Server service runs under a built-in account such as NetworkService, the Grant database access option in SharePoint Central Administration will not work correctly. Consequently, accessing any Reporting Services feature through a SharePoint site will result in the following error:
"An unexpected error occurred while connecting to the report server. Verify that the report server is available and configured for SharePoint integrated mode. --> Server was unable to process request. --> Client found response content type of 'text/html; charset=utf-8', but expected 'text.xml'."
Choose either of the following approaches to avoid this error:
*On the computer that hosts the report server, continue to run the Report Server service as NetworkService and add the built-in account, such as NT_AUTHORITY\NetworkService to the WSS_WPG Windows group.
-- Or --
*Configure the service account to run under a domain user account as follows:
1.Start the Reporting Services Configuration tool and connect to the report server.
2.On the Service Account page, click Use another account, enter a domain user account, and click Apply.
3.Click Web Service Identity, for Report Server, click New, type an application Restart the Report Server service.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)