0

I'm trying to supply specific domain credentials to access reports on my reporting server. If I use default credentials (don't supply actual credits) it works just fine as I have access to my report server. As soon as I hardcode my credentials (and disable default credentials) it gives me a 401 exception (The request failed with HTTP status 401: Unauthorized.)

comboBox1 is a combobox (obviously) with each server available

urlText is a text field for the web service url

        comboBox1.Items.Clear();

        var rs = new ReportingService2005
        {
            Url = urlText.Text,
            //any of those three work
            //Credentials = System.Net.CredentialCache.DefaultCredentials,
            //Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
            UseDefaultCredentials = true

            //This doesn't work
            //Credentials = new NetworkCredential("user", "pass", "domain")
        };

        // get catalog items from the report server database
        var items = rs.ListChildren("/", true);  <------exception on this line---------

        foreach (var item in items)
        {
            if (item.Type == ItemTypeEnum.Report)
                comboBox1.Items.Add(item.Path);
        }

As far as I can tell, that should be all that's needed. It could be something to do with the rsreportserver.config. As it is now, going through the web interface doesn't prompt for credentials (I don't know if that's important or not, just more information).

Here's the authentication section

<Authentication>
    <AuthenticationTypes>
        <RSWindowsNegotiate/>
    </AuthenticationTypes>
    <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
    <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario>
    <EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
claudekennilol
  • 992
  • 2
  • 13
  • 26
  • Similar question and answer here: http://stackoverflow.com/questions/19094828/user-impersonation-between-asp-net-and-ssrs/19100692#19100692. You however are using the ReportingServices namespace to generate but I believe the credentials portion is the same or very similar – djangojazz Oct 03 '13 at 22:14
  • Thanks. The ReportingServices2005 is the ssrs web service reference. This other answer does not appear to be what I need. You're right in that the other answer looks like it should be helpful, but the critical part (reportViewer.ServerReport.ReportServerCredentials.ImpersonationUser = (System.Security.Principal.WindowsIdentity)user;) does not appear to be able to be done with the web service reference. – claudekennilol Oct 04 '13 at 14:33
  • Sorry about that, I assumed it would. There should be something similar though. I would look up the whitepaper on the service. You may also be able to get more credential info from a similar service ReportService2010.asmx (If you have SQL 2012, similar one for earlier versions of SQL). Thread was here: http://stackoverflow.com/questions/14479144/programmatically-export-ssrs-report-from-sharepoint-using-reportservice2010-asmx/14492191#14492191 – djangojazz Oct 04 '13 at 16:44

0 Answers0