问题描述:

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>

相关阅读:
Top