Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm calling a report from report server, the project runs successfully but the page will be empty. through development tool I can find the amount of space it is acquired.

Below is the code i'm using.

Web Config.
under system.web
<httpHandlers>
  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
</httpHandlers>

system.web under compilation
<buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders></pre>

and there are some assemblies which are automatically added when the reportviewer was added to the page.

under system.webservices

<handlers>
  <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>


cs page
C#
int dcid = 1;
ReportViewer1.Visible = true;
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServer"].ToString());
Microsoft.Reporting.WebForms.ReportParameterInfoCollection paramInfo;
System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> paramList = new System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter>();
paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter("DCId", dcid.ToString(), false));
ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["ReportsFolder"].ToString() + "rpt_DCForm";
ReportViewer1.ServerReport.ReportServerCredentials = new Credentials(ConfigurationManager
                                                                     .AppSettings["ReportUserName"].ToString(), ConfigurationManager
                                                                     .AppSettings["ReportUserPwd"].ToString(), ConfigurationManager
                                                                     .AppSettings["ReportserverDomain"].ToString());

ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
ReportViewer1.ServerReport.SetParameters(paramList);
paramInfo = ReportViewer1.ServerReport.GetParameters();
ReportViewer1.ServerReport.Refresh();


Credentials class

C#
string _userName, _password, _domain;
    public Credentials(string userName, string Password, string domain)
    {
        _userName = userName;
        _password = Password;
        _domain = domain;
    }

    #region IReportServerCredentials Members

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

    }

    public System.Security.Principal.WindowsIdentity ImpersonationUser
    {
        get { return null; }
    }

    public System.Net.ICredentials NetworkCredentials
    {
        get { return new System.Net.NetworkCredential(_userName, _password, _domain); }
    }

    #endregion


The same code works fine in our other project. For a new solution Its not working. Please help what I'm missing out.

Thanks in advance.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900