none
The request failed with HTTP status 404: Not Found Report Viewer 2008 ASP.NET RRS feed

  • Question

  • I am getting following error when trying to view a report using report viewer 2008 web control
    ======================

     

    • The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
      • The request failed with HTTP status 404: Not Found.

     

    Here is the code:

    this
    .ReportViewer1.ProcessingMode = ProcessingMode.Remote;

     

    MyReportServerConnection rsc = new MyReportServerConnection();

     

    this.ReportViewer1.ServerReport.ReportServerCredentials = rsc;

     

    this.ReportViewer1.ServerReport.ReportPath = reportPath;

     

    this.ReportViewer1.ServerReport.ReportServerUrl =

     

    new Uri((ConfigurationSettings.AppSettings.Get("MyReportServerUrl")));

     

    this.ReportViewer1.ServerReport.Refresh();

     

    ===========================================

    using

     

    System;

    using

     

    System.Collections.Generic;

    using

     

    System.Linq;

    using

     

    System.Web;

    using

     

    System.Web.UI;

    using

     

    System.Web.UI.WebControls;

    using

     

    Microsoft.Reporting.WebForms;

    using

     

    System.Net;

    using

     

    System.Security.Principal;

    using

     

    System.Configuration;

    [

    Serializable]

    public

     

    class MyReportServerConnection : IReportServerConnection2

    {

     

    public Uri ReportServerUrl

    {

     

    get

    {

     

    string url = ConfigurationSettings.AppSettings.Get("MyReportServerUrl");

     

    if (string.IsNullOrEmpty(url))

     

    throw new Exception("Missing url from the Web.config file");

     

    return new Uri(url);

    }

    }

     

    public int Timeout

    {

     

    // set timeout to 60 seconds

     

    get { return 60000; }

    }

     

    public IEnumerable<Cookie> Cookies

    {

     

    // No custom cookies

     

    get { return null; }

    }

     

    public IEnumerable<string> Headers

    {

     

    // No custom headers

     

    get { return null; }

    }

     

    public MyReportServerConnection()

    {

    }

     

     

    public WindowsIdentity ImpersonationUser

    {

     

    get { return null; }

    }

     

    public ICredentials NetworkCredentials

    {

     

    get

    {

     

    // return null will force the use of impersonation,

     

    // otherwise, remove the return null and

     

    // implement the other app settings to specify the credential details

     

    // return null;

     

    string userName = ConfigurationSettings.AppSettings.Get("myReportViewerUser");

     

    if (string.IsNullOrEmpty(userName))

     

    throw new Exception("Missing user name from Web.config file");

     

    string password = ConfigurationSettings.AppSettings.Get("MyReportViewerPassword");

     

    if (string.IsNullOrEmpty(password))

     

    throw new Exception("Missing password from Web.config file");

     

    string domain = ConfigurationSettings.AppSettings.Get("MyReportViewerDomain");

     

    if (string.IsNullOrEmpty(domain))

     

    throw new Exception("Missing domain from Web.config file");

     

    return new NetworkCredential(userName, password, domain);

    }

    }

     

    public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority)

    {

    authCookie =

    null;

    userName =

    null;

    password =

    null;

    authority =

    null;

     

    return false;

    }

    }

     





    Thursday, October 22, 2009 6:05 PM