Implement IReportServerCredentials error
I took sample code to implement the IReportServerCredentials to send the login information to retrieve a report remotely but for some reason the implementation is error prone. Imports System.Net.NetworkCredential Imports System.Net Imports Microsoft.Reporting.WebForms Imports System.Security.Principal Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Init(ByVal sender As Object, _ ByVal e As System.EventArgs) _ Handles Me.Init ReportViewer1.ServerReport.ReportServerCredentials = _ New ReportServerNetworkCredentials End Sub End Class <Serializable()> _ Public NotInheritable Class ReportServerNetworkCredentials Implements IReportServerCredentials #Region "IReportServerCredentials Members" ''' <summary> ''' Specifies the user to impersonate when connecting to a report server. ''' </summary> ''' <value></value> ''' <returns>A WindowsIdentity object representing the user to impersonate.</returns> Public ReadOnly Property ImpersonationUser() As WindowsIdentity Implements IReportServerCredentials.ImpersonationUser Get Return Nothing End Get End Property ''' <summary> ''' Returns network credentials to be used for authentication with the report server. ''' </summary> ''' <value></value> ''' <returns>A NetworkCredentials object.</returns> Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements IReportServerCredentials.NetworkCredentials Get 'User name Dim userName As String = _ ConfigurationManager.AppSettings("MyReportViewerUser") If (String.IsNullOrEmpty(userName)) Then Throw New Exception("Missing user name from web.config file") End If 'Password Dim password As String = _ ConfigurationManager.AppSettings("MyReportViewerPassword") If (String.IsNullOrEmpty(password)) Then Throw New Exception("Missing password from web.config file") End If 'Domain Dim domain As String = _ ConfigurationManager.AppSettings("MyReportViewerDomain") If (String.IsNullOrEmpty(domain)) Then Throw New Exception("Missing domain from web.config file") End If Return New System.Net.NetworkCredential(userName, password, domain) End Get End Property ''' <summary> ''' Provides forms authentication to be used to connect to the report server. ''' </summary> ''' <param name="authCookie">A Report Server authentication cookie.</param> ''' <param name="userName">The name of the user.</param> ''' <param name="password">The password of the user.</param> ''' <param name="authority">The authority to use when authenticating the user, such as a Microsoft Windows domain.</param> ''' <returns></returns> Public Function GetFormsCredentials(ByVal authCookie As System.Net.Cookie, ByVal userName As String, ByVal password As String, ByVal authority As String) As Boolean _ Implements IReportServerCredentials.GetFormsCredentials authCookie = Nothing userName = Nothing password = Nothing authority = Nothing Return False End Function #End Region End Class in the class declaration there is an error line for <pre><code><span> </span><span><span style="color:#2b91af">Implements</span></span><span> </span><span><span style="color:#2b91af">IReportServerCredentials</span></span><span> <br/></span></code> and it says class must implement function getformscredentials....for interface microsoft.reporting.webforms.ireportservercredentials... Now I have the function implemented so not sure what the problem is.
May 11th, 2011 1:35pm

Your method signature for GetFormsCredentials doesn't match the interface. Here's the autogenerated version in VB (note the ByRef instead of ByVal): 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 End FunctionCephas Lin This posting is provided "AS IS" with no warranties.
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 11:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics