I am having an issue with using the ReportViewer control.
Visual Studio 2010 SP1
.Net 3.5
SSRS 2008 R2
Getting the error:
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 site.
The web application is running on server1, the database and SSRS are on server2. This should not be a 2 hop authorization issue. The .Net application does pull data OK from the database on server2.
I have seen several different solutions discussed. Changing the registry settings seem to be a security hazard. The impersonate does not make a difference in the error.
The report works fine when I go to it directly on the SSRS server. The .Net application works fine when I run locally in debug mode. When I deploy to our test server, I get the error.
I have examined the control before it executed and the ServerReport.ReportPath is set correctly.
I have also examined the ServerReport.ReportServerCredentials and they are being set to the credentials of the user who runs the web application (WindowsIdentity.GetCurrent()). And that user does have access to run the reports.
What I am trying to do is use the credentials of the user who is using the web site and not use a hard coded user id and password. I have set the credentials to WindowsIdentity.GetCurrent().
I also have tried a test where I just create a link to the SSRS report and when I click on the URL link, the report displays fine.
There is something that the reportviewer control is not passing the SSR server.
ChuckMN
Member
4 Points
3 Posts
ReportViewer control request failed with HTTP status 401: Unauthorized
Feb 29, 2012 09:32 PM|LINK
I am having an issue with using the ReportViewer control.
Visual Studio 2010 SP1
.Net 3.5
SSRS 2008 R2
Getting the error:
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 site.
The web application is running on server1, the database and SSRS are on server2. This should not be a 2 hop authorization issue. The .Net application does pull data OK from the database on server2.
I have seen several different solutions discussed. Changing the registry settings seem to be a security hazard. The impersonate does not make a difference in the error.
The report works fine when I go to it directly on the SSRS server. The .Net application works fine when I run locally in debug mode. When I deploy to our test server, I get the error.
Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Mar 01, 2012 04:44 AM|LINK
Dear User,
The main problem is, you are not passing the proper credentials or proper input parameters to the method GetReportParameters.
Points to check:
- Check the report name which you are passing.
- Check the report server credentials you are passing. (Username, Password and Domain)
Please let me know if it still throws up an error.
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.
ChuckMN
Member
4 Points
3 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Mar 01, 2012 01:17 PM|LINK
I have examined the control before it executed and the ServerReport.ReportPath is set correctly.
I have also examined the ServerReport.ReportServerCredentials and they are being set to the credentials of the user who runs the web application (WindowsIdentity.GetCurrent()). And that user does have access to run the reports.
asimjabbar
Member
4 Points
4 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Mar 02, 2012 04:19 AM|LINK
Boss
Ur web.config has settings:
<authentication mode="Windows" />
<identity impersonate="true" />
if u r impersonating users with windows authentication then kindly provide valid ID and passcode with it
i.e
<authentication mode="Windows" />
<identity impersonate="true" userName="Domain\username" password="password"/>
hope it will help.
kindly reply to my last post regarding RSClientPrint Report Printing.
Many Thanks
Asim Jabbar
Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Mar 02, 2012 05:16 AM|LINK
Dear ChuckMN,
Microsoft.Reporting.WebForms.ReportParameter[] RptParameters; reportViewer.ServerReport.ReportServerUrl = new System.Uri(ConfigurationManager.AppSettings["ReportServerURL"]); reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; reportViewer.ToolBarItemBorderColor = System.Drawing.Color.PowderBlue; reportViewer.ToolBarItemBorderStyle = BorderStyle.Double; string strUserName = ConfigurationManager.AppSettings["UserName"].ToString(); string strPassword = ConfigurationManager.AppSettings["Password"].ToString(); string strDomain = ConfigurationManager.AppSettings["Domain"].ToString(); reportViewer.ServerReport.ReportServerCredentials = new ReportCredentials(strUserName, strPassword, strDomain); string strReport = string.Empty; strReport = ConfigurationManager.AppSettings["ReportsFolder"] + Request.QueryString["ReportName"].ToString();Referred from my article.
http://srikanthkasturi.webs.com/apps/blog/entries/show/8662369-ssrs-reports-with-net
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.
ChuckMN
Member
4 Points
3 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Mar 02, 2012 01:02 PM|LINK
What I am trying to do is use the credentials of the user who is using the web site and not use a hard coded user id and password. I have set the credentials to WindowsIdentity.GetCurrent(). I also have tried a test where I just create a link to the SSRS report and when I click on the URL link, the report displays fine.
There is something that the reportviewer control is not passing the SSR server.
Still not working...
pmgerholdt
Participant
1237 Points
248 Posts
Re: ReportViewer control request failed with HTTP status 401: Unauthorized
Nov 01, 2012 12:59 PM|LINK
Chuck,
I imagine you've resolved this by now. Can you tell me how?