views:

23

answers:

1

Hi There

View have a central report server running SSRS, all our reporta are already built and present on the server.

How can i now dispaly one of those reports using ReportViewer Contontrol in ASP.NET?

My Control:

<rsweb:ReportViewer ID="ctReportViewer" runat="server"  />

My CodeBehind:

var reportServer = ctReportViewer.ServerReport;
        reportServer.ReportServerUrl = new Uri(@"http://&lt;MYSERVERNAMEHERE&gt;/reportsdev");
        reportServer.ReportPath = @"/OneFm/ArrearCollectionPerRegion";
        reportServer.ReportServerCredentials = new ReportViewerCredentials("<USERNAME>", "<PASSWORD>", "<DOMAIN>");
        ctReportViewer.DataBind();

public partial class ReportViewerCredentials : IReportServerCredentials
    {
        private string _userName;
        private string _password;
        private string _domain;

        public ReportViewerCredentials(string userName, string password, string domain)
        {
            _userName = userName;
            _password = password;
            _domain = domain;

        }


        public WindowsIdentity ImpersonationUser
        {
            get
            {
                return null;
            }
        }

        public ICredentials NetworkCredentials
        {
            get
            {

                return new NetworkCredential(_userName, _password, _domain);

            }
        }

        public bool GetFormsCredentials(out Cookie authCookie,
                out string userName, out string password,
                out string authority)
        {
            authCookie = null;
            userName = _userName;
            password = _password;
            authority = _domain;

            // Not using form credentials  
            return false;
        }
    }

Link to report:

http://&lt;MYSERVERNAMEHERE&gt;/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion

I've searched high and low.

I am running SSRS2005, and i am using VS2008 if that counts for anything.

An example would really be appreciated.

A: 

Managed to figure it out thanx:

        var reportName = "SalesTargets"
        ctReportViewer.ServerReport.ReportServerUrl = new Uri("http://&lt;MYREPORTSERVER&gt;/reportserverdev");
        ctReportViewer.ServerReport.ReportPath = @"/OneFm/" + reportName;
        ctReportViewer.ProcessingMode = ProcessingMode.Remote;
        ctReportViewer.ServerReport.Refresh();
        ctReportViewer.AsyncRendering = false;
        ctReportViewer.SizeToReportContent = true;
Dusty Roberts