mimarcos
mimarcos

Reputation: 93

SQL Server Reporting Services ReportViewer authentication

I'm working on a project involving the .NET ReportViewer, and I'm having issues connecting to the Report Server.

I'm a .NET newbie so bear with me. I can't put up the code but hopefully someone will be able to give me a little guidance here. I dragged the ReportViewer control from the toolbox onto a newly created page. Eleventy billion issues later, I got to the point where it looks like it's connecting to the appropriate server.

Now, I don't have any C# code in here. It's all in these fustrating tags.

So, I have a tag. Nested within, a tag. The ServerReport tag has 2 attributes, ReportPath and ReportServerUrl. I added a second, ReportServerCredentials, but do not know how to format it. Every example I've seen has been using C# code to create the object, but I'd like to do this without going down that route.

Is there a way to pass a user and password using the ReportServerCredentials="" attribute?

Upvotes: 0

Views: 7621

Answers (1)

orka
orka

Reputation: 1328

Default authentication provider for reporting services is windows authentication. So, if you want to connect to reporting services via reporviewer you should use a windows credential. on the other hand you have options to implement forms authentication or use custom authentication you have developed.

If you are using the WinForms version you may set the credential easily as follows:

ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = System.Net.CredentialCache.DefaultCredentials;

Unfortunately that property is read only for the ASP.NET version, so I suggest you to look at SSRS ReportServerCredentials thread. If it doesn't meet your requirements then you may need to implement IReportServerCredentials to send your username and password to the report server.

Hope this help.

Upvotes: 3

Related Questions