locked
Report Viewer 10.0.0.0 - Can't connect to SSRS RRS feed

All replies

  • User-8475372 posted

    Dear User, 

    Please use this code: 

    This code helps in connecting with the reports hosted in the MS-SSRS through .NET code. (Example is with C# 4.0 Framework)
    ----------------------------------------------------------------------------------------------------------------
    Microsoft.Reporting.WebForms.ReportParameter[] RptParameters;


                reportViewer.ServerReport.ReportServerUrl = new System.Uri(ConfigurationManager.AppSettings["ReportServerURL"]);
                reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
                reportViewer.ToolBarItemBorderColor = System.Drawing.Color.PowderBlue;
                reportViewer.ToolBarItemBorderStyle = BorderStyle.Double;


                string strUserName = ConfigurationManager.AppSettings["UserName"].ToString();
                string strPassword = ConfigurationManager.AppSettings["Password"].ToString();
                string strDomain = ConfigurationManager.AppSettings["Domain"].ToString();
                reportViewer.ServerReport.ReportServerCredentials = new ReportCredentials(strUserName, strPassword, strDomain);
                string strReport = string.Empty;
                strReport = ConfigurationManager.AppSettings["ReportsFolder"] + Request.QueryString["ReportName"].ToString();


    Below snippet shows on how to pass parameters to the report  :


                    this.reportViewer.ServerReport.ReportPath = strReport;
                    RptParameters = new Microsoft.Reporting.WebForms.ReportParameter[1];
                    RptParameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("                                                      <ParameterName>", "<ParameterValue>");               
                    this.reportViewer.ServerReport.SetParameters(RptParameters);     
                    reportViewer.ServerReport.Refresh();


    You can pass any number of parameters to the report. Just make sure that the <ParameterName> matches with the parameter name in the report. 

    Tuesday, May 15, 2012 12:37 AM
  • User-1461584407 posted

    Thanks for the response.

    What does your ReportCredentials class look like?

    Tuesday, May 15, 2012 10:35 AM
  • User-1461584407 posted

    This didn't become an issue until I updated from Report Viewer 9.0.0.0 to 10.0.0.0

    Tuesday, May 15, 2012 11:34 AM
  • User-8475372 posted

    public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
    {
    string _userName, _password, _domain;
    public ReportCredentials(string userName, string password, string domain)
    {
    _userName = userName;
    _password = password;
    _domain = domain;
    }
    public System.Security.Principal.WindowsIdentity ImpersonationUser
    {
    get
    {
    return null;
    }
    }
    public System.Net.ICredentials NetworkCredentials
    {

    get
    {

    return new System.Net.NetworkCredential(_userName, _password, _domain);

    }

    }

    public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)
    {
    userName = _userName;
    password = _password;
    authority = _domain;
    authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");
    return true;
    }
    }

    There are some issues with Report Viewer 10.0. Even we have to roll it back to 9.0 for some issues. 

    Tuesday, May 15, 2012 12:54 PM