locked
ReportViewer error - The request failed with HTTP status 401: Unauthorized. RRS feed

  • Question

  • User-1784990200 posted

    I am using Visual Studio 2010 SP1, .Net 4.0, SSRS 2008 R2, Windows XP Professional

    The following is the error I am getting, when I am trying to run reports using Visual Studio 2010 (debug mode) on my development machine.
    The request failed with HTTP status 401: Unauthorized. 

    The web.config has settings:

    <authentication mode="Windows" />
    <identity impersonate="true" />

    I have set up a class for WindowsImpersonationCredentials : IReportServerCredentials
    Checked the ServerReport.ReportServerCredentials before running the report and it has the user ID who is logged into the machine, but ServerReport.ReportServerCredentials.ImpersonateUser is null just before running the report.

    The web application and the SSRS are on the same development machine. 

    Changed the DisableloopCheck to 1 in the registry didn't make any difference.

    The report works fine when I run it directly from the report manager. 

    The same code works fine on the server suprsingly but not my local machine (debug mode)

    Couldn't figure out what on earth is going on behind the scenes. Any help would be really appreciated.

    Thanks.

    Monday, October 8, 2012 11:39 AM

All replies

  • User-8475372 posted

    First question, how are you finding out the current user in your application ? Http Current Context ? Please can you share that line ? 

    Tuesday, October 9, 2012 2:25 AM
  • User-1784990200 posted

    Thanks for your reply.

    The username, password and domain are hardcoded and stored in the web.config as follows and passed onto to ReportServerConnection.NetworkCredentials method.

            <add key="ReportViewerServerConnection" value=" App_Code.ReportServerConnection, App_Code"/>
            <add key="ReportViewerUser" value="username1"/>
            <!-- Used as the user name by the ReportServerConnection class. -->
            <add key="ReportViewerPassword" value="password1"/>
            <!-- Used as the password by the ReportServerConnection class. -->
            <add key="ReportViewerDomain" value="domainName"/>
            <!-- Used as the domain by the ReportServerConnection class. -->
            <add key="ReportServerUrl" value="http://localhost:90/reportserver"/>

    Tuesday, October 9, 2012 4:37 AM