SQL Server Reporting Services ReportViewer 身份验证
我正在开发一个涉及 .NET ReportViewer 的项目,并且在连接到报表服务器时遇到问题。
我是 .NET 新手,请耐心等待。我无法提供代码,但希望有人能够在这里给我一些指导。我将 ReportViewer 控件从工具箱拖到新创建的页面上。一千亿个问题之后,我发现它看起来正在连接到适当的服务器。
现在,我这里没有任何 C# 代码。这一切都在这些令人沮丧的标签中。
所以,我有一个标签。嵌套在标签内。 ServerReport 标记有 2 个属性:ReportPath 和 ReportServerUrl。我添加了第二个 ReportServerCredentials,但不知道如何格式化它。我见过的每个示例都使用 C# 代码来创建对象,但我想这样做而不是走那条路。
有没有办法使用 ReportServerCredentials="" 属性传递用户和密码?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
报告服务的默认身份验证提供程序是 Windows 身份验证。因此,如果您想通过 reporviewer 连接到报告服务,您应该使用 Windows 凭据。另一方面,您可以选择实施表单身份验证或使用您开发的自定义身份验证。
如果您使用的是 WinForms 版本,您可以轻松设置凭据,如下所示:
ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = System.Net.CredentialCache.DefaultCredentials;
不幸的是,该属性对于 ASP.NET 是只读的版本,所以我建议您查看 SSRS ReportServerCredentials 线程。如果它不满足您的要求,那么您可能需要实施 IReportServerCredentials 将您的用户名和密码发送到报表服务器。
希望这有帮助。
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.