Reportviewer and credential

Hi,

I would like to create a link between my report server (SSRS 2005) and my ERP  

But when  I compile I have this message :

  • The request failed with HTTP status 401: Unauthorized.
  • I add a network credential as I saw in sample. But I have another

    if (!IsPostBack)
    {
       ReportViewer2.ServerReport.DisplayName =
    "Text Report Viewer";
       ReportViewer2.ServerReport.ReportServerUrl =
    new Uri(http://report.domaineName.com/ReportServer);
       ReportViewer2.ServerReport.ReportPath =
    "/ReportsFicheIntervention/ReportInterventionsParRepresentant";
       NetworkCredential myCred =
    new NetworkCredential("login", "password");
       ReportViewer2.ServerReport.ReportServerCredentials = myCred;
       ReportViewer2.ServerReport.Refresh();
    }

    Cannot implicitly convert type 'System.Net.NetworkCredential' to 'Microsoft.Reporting.WebForms.IReportServerCredentials'.
    An
    explicit conversion exists (are you missing a cast )

     

     




    Answer this question

    Reportviewer and credential

    • Abahay

      IReportServerCredentials is not the same as NetworkCredentials. The viewer needs credentials after the page has finished executing (to retrieve report images, for example). Depending on your deployment, it may or may not be necessary to store these credentials in memory while the report is open. So the viewer uses the IReportServerCredentials interface to allow you to specify credentials to the report server any way you want. You can keep them in memory, or read them from the config file on demand, or base them on the incoming request, for example.

      You will need to implement the interface on a serializable object and assign that object to this property.


    • Reportviewer and credential