none
Accessing SSRS 2008 report in Visual Studio 2010 web site RRS feed

  • Question

  • I have a report (.rdl) in SSRS 2008 on report server. I can access this report on the server as well as from my machine like http://servername/Reports.

     

    I want to access this report from a local website on my machine. I am using ReportViewer control for this. I have following code on my Default.aspx

     

    <div>

     <asp:ScriptManager ID="ScriptManager1" runat="server">

     </asp:ScriptManager>

     <rsweb:ReportViewer ID="ReportViewer1" runat="server">

     </rsweb:ReportViewer>

    </div>

     

    On Default.aspx.cs, I have following code-

    protected void Page_Load(object sender, EventArgs e)

    {

    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

            ReportViewer1.ShowCredentialPrompts = true;

            ReportViewer1.ShowExportControls = true;

            ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["Password"], ConfigurationManager.AppSettings["SERVERNAME"]);

            ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://servername/Reports"); // Report Server URL

            ReportViewer1.ServerReport.ReportPath = "test"; // Report Name

            ReportViewer1.ShowPrintButton = true;

            ReportViewer1.ServerReport.Refresh();

    }

    Now when I run this site on browser as - http://localhost/TestReport/default.aspx, I get following error-

    The request failed with HTTP status 401: Unauthorized


    Tuesday, July 26, 2011 4:02 PM