Where does the DefaultCredentials pull out "UserName" as the username for the web request?

There is an application here WinFormsthat is trying to connect to the service SSRS. The report server is configured to accept both Active Directory credential accounts and user-specific credentials for reporting purposes. In the next section of code we use WinForms ReportViewer:

reportViewer.ServerReport.ReportServerUrl = new Uri(_dboardServices.ReportingServicesUrl);
reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = CredentialCache.DefaultCredentials;

This works great on my development machine and for most of our customers. But some clients experience 401: System.Net.WebException: The request failed with HTTP status 401: Unauthorizedcoming from the SoapHttpClient system. Interestingly, I can reproduce this problem on my machine. Looking into the traffic with the help Fiddler, authentication starts NTLM, and then "UserName" (literally!) Is sent as a username instead of my real username. Obviously this fails.

If I create credentials with the correct username, password and domain ( reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(goodUserName, goodPassword, domain);), my request will succeed. As if I went to the link SSRS asmxand enter my credentials. But CredentialCache.DefaultCredentials(which should use my AD credentials by default) pulls this "username" from somewhere. Where does this system get from? So far I have been looking for our source code and web interface.

+4
source share
1 answer

This is probably a problem with saved credentials. Find out what credentials you saved by running control keymgr.dllon the command line. See Article.

+3
source

All Articles