I need some serious help and I am at my wits end:
I am using webhost4life and using their reporting services. I am 'trying' to create a simple aspx page with the web report viewer and point to a report on the server. I found some code on this news group (see below) regarding passing credentials but I am still getting access denied in the report viewer. Can any please help me
Imports Microsoft.VisualBasic
Imports com.mysite4now.sql332reporting
Imports Microsoft.Reporting.WebForms
Imports System.Security.Principal
Partial Class reportviewer
Inherits System.Web.UI.Page
Public Class ReportViewerCredentials
Implements IReportServerCredentials
Private _userName As String
Private _password As String
Private _domain As String
Public Sub New(ByVal userName As String, ByVal password As String, ByVal domain As String)
_userName = userName
_password = password
_domain = domain
End Sub
Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser
Get
Return Nothing
End Get
End Property
Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials
Get
Return New Net.NetworkCredential(_userName, _password, _domain)
End Get
End Property
Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
userName = _userName
password = _password
authority = _domain
Return Nothing
End Function
End Class
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rs As New ReportingService
rs.LogonUser("tonystoker", "stoker31", "")
ReportViewer1.ServerReport.ReportServerCredentials = New ReportViewerCredentials("sql332\tonystoker", "Stoker31", "")
ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://sql332reporting.mysite4now.com/reports")
ReportViewer1.ServerReport.ReportPath = "/PAData/General Ledger Summary Report"
ReportViewer1.ShowReportBody = True
ReportViewer1.Visible = True
End Sub
End Class

HELP using reporting services on hosting company
carzyR
Brian-
Thanks for the feedback but unfort. I have tried all that.....I think I have gotten past the credentials issues but now I am getting a different error message in the reportviewer:
Webhost4life has confirmed that this is a 2005 sql reporting services server and I have tried every different path for my report and still no luck.
ocanon
Freek Bos
RSatter
I don't generally program in VB, but if VB is the same as C# in regards to escape characters, then "sql332\tonystoker" needs to be "sql332\\tonystoker", since \t is a tab character.
Also, I suspect that sql332 needs to be passed in as the domain parameter and not part of the user name.
While I'm not familiar with your hosting environment, it is typically the case that you set the NetworkCredentials property or the forms credentials, but not both.