I\'m getting an 401 unauthorized error when using the ReportViewer on my test server. On my local environment (with the configurations pointed to the test server), I\'m able to
I was able to figure out the answer and more importantly how to resolve the issue causing the 401 error.
First to answer my question, I was able to figure out the user by inspecting
System.Security.Principal.WindowsIdentity.GetCurrent().Name
When running the app in my local environment (the report server was pointed to the test url), it was using Windows login. Under the test server, it is using IIS APPPOOL
. I tried setting the report server credentials manually but with no success.
ReportViewer rv;
rv.ServerReport.ReportServerCredentials = new ReportServerCredentials("userName", "password", "domain");
However, I noticed by inspecting IIS manager where the login was coming from.
When I changed the identity to a NetworkService
, the application was able to access the report server correctly.