Hello, I have a reportviewer and I want to set its credentials with this line but I have that error.
rptViewer.ServerReport.ReportServerCredentials = new System.Net.NetworkCredential(usuario, clave, dominio);
Error 18 Cannot implicitly convert type 'System.Net.NetworkCredential' to 'Microsoft.Reporting.WebForms.IReportServerCredentials'. An explicit conversion exists (are you missing a cast?) C:\Inetpub\wwwroot\GescomDllo\Protected\01_Administradores\rptdefinicioncompetencias.aspx.cs 40 58 http://localhost/GescomDllo/
any idea?
I tried this with no luck
rptViewer.ServerReport.ReportServerCredentials = (Microsoft.Reporting.WebForms.IReportServerCredentials)new System.Net.NetworkCredential(usuario, clave, dominio);
Unable to cast object of type 'System.Net.NetworkCredential' to type 'Microsoft.Reporting.WebForms.IReportServerCredentials'.
|||There is a property on the IReportServerCredentials interface that allows you to get or set an object that implements ICredentials. And the NetworkCredential class of the .Net Framework implements this interface, so you can set your NetworkCredential instance to this property. For example,rptViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential(usuario, clave, dominio);
|||Ian,
This would work just fine, but ... NetworkCredentials is read only ...
|||Are you using the WebForm or WinForm version of the control? With the WebForm version, the ReportServerCredentials property returns the IReportServerCredentials interface that has the read-only NetworkCredentials property, but the WinForm version returns a ReportServerCredentials class that has a read/write NetworkCredentials property.
No comments:
Post a Comment