Webforms ReportViewer issues with IReportServerCredentials conversion from C# to VB

Hi,

Going round and round in circles ! I have an example in c# that works, when I try and convert to vb I can't get it to compile with

must implement 'ReadOnly Property NetworkCredentials As System.Net.ICredentials' for interface 'Microsoft.Reporting.WebForms.IReportServerCredentials'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers

anybody been through this before or have a vb example that works ??

I've attached both example code files that both work off this...

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" 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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server">

        </rsweb:ReportViewer>
   
    </div>
    </form>
</body>
</html>
Default.aspx.cs
Default.aspx.vb
LVL 1
Steve JebsonDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
In VB.NET you use keywords on methods that are event (Handles) or interface (Implements) related; e.g. -
Imports Microsoft.Reporting.WebForms
Imports System.Net

Public Class _Default
	Inherits System.Web.UI.Page

	Protected Sub Page_Load(sender As Object, e As EventArgs) Handles MyBase.Load
		If Not Me.IsPostBack Then
			ReportViewer1.Width = 800
			ReportViewer1.Height = 600
			ReportViewer1.ProcessingMode = ProcessingMode.Remote
			Dim irsc As IReportServerCredentials = New CustomReportCredentials("stevejebson-001", "********", "ifc")
			' e.g.: ("demo-001", "123456789", "ifc")
			ReportViewer1.ServerReport.ReportServerCredentials = irsc
			ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://sql5002.smarterasp.net/ReportServer")
			ReportViewer1.ServerReport.ReportPath = "/stevejebson-001/SiteInspections"
			'e.g.: /demo-001/test
			ReportViewer1.ServerReport.Refresh()
		End If
	End Sub
End Class

Public Class CustomReportCredentials
	Implements IReportServerCredentials
	Private _UserName As String
	Private _PassWord As String
	Private _DomainName As String

	Public Sub New(UserName As String, PassWord As String, DomainName As String)
		_UserName = UserName
		_PassWord = PassWord
		_DomainName = DomainName
	End Sub

	Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements IReportServerCredentials.ImpersonationUser
		Get
			Return Nothing
		End Get
	End Property

	Public ReadOnly Property NetworkCredentials() As ICredentials Implements IReportServerCredentials.NetworkCredentials
		Get
			Return New NetworkCredential(_UserName, _PassWord, _DomainName)
		End Get
	End Property

	Public Function GetFormsCredentials(ByRef authCookie As Cookie, ByRef user As String, ByRef password As String, ByRef authority As String) As Boolean Implements IReportServerCredentials.GetFormsCredentials
		authCookie = Nothing
		user = InlineAssignHelper(password, InlineAssignHelper(authority, Nothing))
		Return False
	End Function
	Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
		target = value
		Return value
	End Function
End Class

Open in new window

-saige-

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve JebsonDeveloperAuthor Commented:
Man thankyou so much ! I've been searching everywhere for this solution, can't believe there was nothing out there pointing out the Implements on those functions. Nice one :)
Rommel MojicaCommented:
Thank you very much
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.