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
Imports Microsoft.Reporting.WebForms
Imports System.Security.Principal
<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
dim userName As String = _
ConfigurationManager.AppSettings("MyReportViewerUser")
If (String.IsNullOrEmpty(userName)) Then
Throw New Exception("Missing user name from web.config file")
End If
Dim password As String = _
ConfigurationManager.AppSettings("MyReportViewerPassword")
If (String.IsNullOrEmpty(password)) Then
Throw New Exception("Missing password from web.config file")
End If
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
on the class declaration there is an error line for
Implements IReportServerCredentials
and it says class must implement function getformscredentials....for interface microsoft.reporting.webforms.ireportservercredentials...
Now when I change the function accordingly it still gives the same error.