Convert System.Net.NetWorkCredentials to IReportServerCredentials
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); Error18Cannot 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.cs4058http://localhost/GescomDllo/ any idea??
June 12th, 2006 9:28pm

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'.
Free Windows Admin Tool Kit Click here and download it now
June 12th, 2006 9:31pm

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);
June 13th, 2006 12:54am

Ian, This would work just fine, but ... NetworkCredentials is read only ...
Free Windows Admin Tool Kit Click here and download it now
September 29th, 2006 8:06pm

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.
September 29th, 2006 11:30pm

below code worked to meIReportServerCredentials irsc = new CustomReportCredentials("username", "password", "domainname"); rptRebuttalAgingRpt.ServerReport.ReportServerCredentials = irsc;rptRebuttalAgingRpt.ServerReport.ReportServerUrl = new Uri(System.Configuration.ConfigurationSettings.AppSettings["ReportServerURI"].ToString()); rptRebuttalAgingRpt.ServerReport.ReportPath = System.Configuration.ConfigurationManager.AppSettings["ReportPath"].ToString();rptRebuttalAgingRpt.ServerReport.Refresh();Regards,Naiduvrsanaidu@gmail.com
Free Windows Admin Tool Kit Click here and download it now
April 18th, 2008 6:11pm

Just to complement the vrsanaidu's reply: http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/5aa7eee7-d4a7-427a-ab8d-7a3d4d4f0bf3 Regards Julio Cesar Orta System Developer
October 18th, 2010 10:04pm

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

Other recent topics Other recent topics