Hello..
I created a VB.NET page to display a SSRS report on a separate webpage and hopefully, keep the SQL server from being viewable from the iNet. URL Variables will be passed to the report ultimately.
I entered the credential and server information within the web.config file and have the code calling this from here. Also have a "credentials.vb" class within the App_Code folder.
When I step through the debugging, I keep getting a 401, unauthorized error on the "RV.ServerReport.SetParameters(New ReportParameter() {param1})" line. Yet, I can open web browsers, visit the server, browse to the reports and
bring them up. I configured the SSRS server to allow Everyone, Browser permissions.
The account credentials being used are a domain administrator account for testing purposes.
Any assistance would be greatly appreciated. Thanks..
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SSRSTest.aspx.vb" Inherits="SSRSTest" %><%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title>Untitled Page</title></head><body><form id="form1" runat="server"><div></div><asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager><rsweb:ReportViewer ID="RV" runat="server" Font-Names="Verdana"
Font-Size="8pt" ProcessingMode="Remote" Width="840px" Height="800px"
ShowParameterPrompts="True" EnableViewState="True"></rsweb:ReportViewer></form></body></html>
Imports Microsoft.Reporting.WebForms
Partial Class SSRSTest
Inherits System.Web.UI.Page
Private Report As String = "/Taxbills/Taxbill_1stHalf_parcel"
Dim TaxYear As Integer
Dim EmailAddress As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TaxYear = Request.QueryString("Year")
EmailAddress = Request.QueryString("Email")
If TaxYear = 0 Then
TaxYear = "2015"
End If
If EmailAddress Is Nothing Then
EmailAddress = "me@home.com"
End If
If Not IsPostBack Then
InitializeReportCredentials()
End If
End Sub
Private Sub InitializeReportCredentials()
Dim server As String = ConfigurationManager.AppSettings("ReportServer")
Dim reportpath As String = ConfigurationManager.AppSettings("ReportsFolder")
Dim username As String = ConfigurationManager.AppSettings("Username")
Dim password As String = ConfigurationManager.AppSettings("Password")
Dim param1 As New ReportParameter("Year", TaxYear)
Dim param2 As New ReportParameter("emailaddy", EmailAddress.ToString)
RV.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
RV.ServerReport.ReportServerUrl = New System.Uri(server)
RV.ServerReport.ReportPath = String.Concat(reportpath, Report)
RV.ServerReport.ReportServerCredentials = New ReportCredentials(username, password, "")
RV.ServerReport.SetParameters(New ReportParameter() {param1})
RV.ServerReport.SetParameters(New ReportParameter() {param2})
'RV.ServerReport.SetParameters(param1)
'RV.ServerReport.SetParameters(param2)
RV.ServerReport.Refresh()
End Sub
End Class