Credentials in Reporting Services??
I have created several reports in SQL Server 2005 reporting services and I am viewing those reports in my C# application using a report viewer control. I want to pass the credentials for each report through my applications. I do not want to use any web service. Is it possible??? Any help will be appreciated!!! TIA
July 5th, 2006 4:43pm

YOu can use the URL Parameters to pass the username and the password, look in the BOL for more information, the syntax for that is:prefix:datasourcename=valueas the prefix is dsu (for user) or dsp (for password)HTH, Jens Suessmeyer.---http://www.sqlserver2005.de---
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2006 4:51pm

Thanks for your reply Jens!!! But I am using a Report Viewer control in my application. How can I pass the username and password in this case??
July 5th, 2006 6:45pm

Hi, Hope this could help you System.Net.CredentialCache myCache = new System.Net.CredentialCache(); myCache.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new System.Net.NetworkCredential("user", "pass")); reportViewer.ShowCredentialPrompts = false; reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache; reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; reportViewer.ServerReport.ReportServerUrl ="http://localhost/reportserver"; reportViewer.ServerReport.ReportPath = "/yourReportFolder/" + "yourReportName"; reportViewer.PromptAreaCollapsed = false; reportViewer.RefreshReport();
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2006 12:08pm

I am trying to use the example code provided for a simialr problem but the line (in VB) reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = myCache always shows as read only. How do I get round this please?
August 16th, 2006 1:58pm

Hi , I think your using report viewer web control ofr asp.net. I had same problem.Its won't work for Microsoft.Reporting.WebForms.ReportViewer.But i hope this link could help you..http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=373983&SiteID=1If you found the way please post back here.Thanks & Best Regards
Free Windows Admin Tool Kit Click here and download it now
August 17th, 2006 9:48am

I am attempting to secure my reports with Windows Authentication, but allow users of my application to access it from the www and supply credentials through my app. My app is a .Net 2.0 Windows SmartClient, and I am using the ReportViewer control. I tried the following suggestion: reportViewer1.ServerReport.ReportServerUrl = new Uri(_txtServer.Text); reportViewer1.ServerReport.ReportPath = _listBox.Items[_listBox.SelectedIndex].ToString(); reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; CredentialCache cc = new CredentialCache(); cc.Add(new Uri("http://localhost/ReportServer/ReportService.asmx"), "Basic", new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text)); reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = cc; reportViewer1.ShowCredentialPrompts = false; reportViewer1.RefreshReport(); ...But I still get "The request failed with HTTP status 401: Access Denied." I am able to authenticate with the web service directly when requesting a list of available reports like this: ReportingService rService = new ReportingService(); rService.Credentials = new NetworkCredential(_txtUsername.Text, _txtPassword.Text, _txtDomain.Text); CatalogItem[] catalogItems; catalogItems = rService.ListChildren("/", true); Why can I pass windows credentials to the web service directly, but not through the reportViewer call to reporting services? Any help would be very much appreciated!
September 6th, 2006 1:21am

Hi Glenn, You might have got thesolution for your problem, If not and/or for other developers who might visit this blog,please find the solution at following link. Actually you can get it work by setting ImpersonationUser instead of NetworkCredentials property. http://blogs.msdn.com/bimusings/archive/2005/11/05/489423.aspx
Free Windows Admin Tool Kit Click here and download it now
September 13th, 2006 12:12pm

You can refer following link. http://msdn2.microsoft.com/en-us/library/microsoft.reporting.webforms.ireportservercredentials(VS.80).aspx
February 2nd, 2007 1:39pm

Hi, you can try this, might help. Ipass the datasource credential through ReportViewer. It is the acutal database login credential instead of a net work credential. So in my application, which login user has nothing to do with Windows network login user, I am using my application's user id and password to connect to datasource. By doing this way, I can view a report using diffirent user id/password as long as they exist in the actual database. It works for me. private void Form1_Load(object sender, EventArgs e) { ............................. Microsoft.Reporting.WinForms.DataSourceCredentials myCredential = new Microsoft.Reporting.WinForms.DataSourceCredentials(); myCredential.UserId = "myuserid"; myCredential.Password = "mypassword"; ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources(); DataSourceCredentials[] myCredentials=null; if (reportdatasourcecollection.Count > 0) { myCredentials = new DataSourceCredentials[reportdatasourcecollection.Count]; } for (int iIndex = 0; iIndex < reportdatasourcecollection.Count; iIndex++) { ReportDataSourceInfo datasourceinfo = reportdatasourcecollection[iIndex]; myCredential.Name = datasourceinfo.Name; myCredentials[iIndex] = myCredential; } this.reportViewer1.ServerReport.SetDataSourceCredentials( myCredentials ); ............................... }
Free Windows Admin Tool Kit Click here and download it now
February 22nd, 2007 3:12am

Hi, I am facing the same problem. I used ReportDataSourceInfo then it gives error that DataSource doesnt support it. Error of rsdatasource So what should be the Connection Methods in Shared DataSource? Nilesh
March 18th, 2007 10:09am

Me too there's an error here. ReportDataSourceInfoCollection reportdatasourcecollection = this.reportViewer1.ServerReport.GetDataSources(); any thoughts please? thanks.
Free Windows Admin Tool Kit Click here and download it now
March 19th, 2007 3:49pm

Ishwar, Thanks for the link. That is awesome. I got it working using the following code. ServerReport.ReportServerCredentials.NetworkCredentials = new NetworkCredential(properties.Username, properties.Password, properties.Domain);
June 14th, 2007 7:11pm

hi, I am trying to Pass the connection string dynamically. Like Data Source= "x"; Initial Catalog ="y"; UserName = "z"; password="A"; Please suggest me .... THanks in Advance. Senthil
Free Windows Admin Tool Kit Click here and download it now
March 11th, 2008 2:49pm

This post was very very useful... Thank u :-)
April 1st, 2008 4:28pm

Hi, I am using RS 2005 and accessing it from .NET. Currently I am accessing reports by just passing report URL and parameters. I am achieving this by using form.action="reportURL"; form.submit(); This renders the report and display in my application. I have not added reference of this reporting service in my application. I understand that, this is anonymous access to reports in which I am just viewing reports. Now, I want to pass credentials to authenticate the request for reports and then only display it. I am also planning to use RS 2008 in near future. NOTE: I googled and found code like create instance of reporting service and then set credentials (AS in above posts also). But in my case we don't have reference of reporting service in my project. Can any one confirm that dsu:datasource:username is for authenticating reporting service access or it to access datasource of reporting service. I would appreciate any good approach to achieve authentication in my case. Thanks.
Free Windows Admin Tool Kit Click here and download it now
January 13th, 2012 8:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics