SQL Server 2005 Reporting Service problem

Discussion in 'ASP.NET 2.0' started by wotr, Sep 23, 2007.

  1. Hi,

    Please help me regarding following issue.
    I want to access reports from sql server 2005 report server through C#.NET.
    On localhost it was giving error as 'The request failed with HTTP status 401: Unauthorized'
    but when i deployed application on discountasp.net server, it is giving error as follows:

    ---------------------------------------------------------------------------------------------------------------------------------------------------
    Could not load file or assembly 'Microsoft.SqlServer.WebServiceTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.WebServiceTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
    ---------------------------------------------------------------------------------------------------------------------------------------------------

    I wrote code on button click as follows:

    protected void Button1_Click(object sender, EventArgs e)
    {
    ReportViewer1.ShowCredentialPrompts = false;
    ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials('Username', 'Password', 'Domain');
    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
    ReportViewer1.ServerReport.ReportServerUrl = new System.Uri('https://rs2k501.discountasp.net');
    ReportViewer1.ServerReport.ReportPath = '/Path';
    ReportViewer1.ServerReport.Refresh();
    }
    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;
    }
    }
     
  2. Bruce

    Bruce DiscountASP.NET Staff

Share This Page