配置报表服务器以进行表单身份验证
问题描述:
我正在使用ReportViewer连接到报表服务器。视窗authenticaton效果很好..但是当我用证书来验证报告服务器我得到了错误:配置报表服务器以进行表单身份验证
The request failed with HTTP status 401: Unauthorized.
我知道我需要在报表服务器配置为接受这些凭据,但我不知道什么实际它是。是的,我已经通过msdn以及堆栈问题了。我是SSRS的完整初学者,我想将报表服务器集成到我的Web应用程序中。我已经在我的应用程序页面做的是:
protected void Page_Load(object sender, EventArgs e)
{
// if (!IsPostBack)
// {
ReportViewer1.ServerReport.ReportServerCredentials =
new MyReportServerCredentials();
// ReportViewer1.ServerReport.Refresh();
//}
}
}
[Serializable]
public sealed class MyReportServerCredentials : IReportServerCredentials
{
public WindowsIdentity ImpersonationUser
{
get
{
// Use the default Windows user. Credentials will be
// provided by the NetworkCredentials property.
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
// Read the user information from the Web.config file.
// By reading the information on demand instead of
// storing it, the credentials will not be stored in
// session, reducing the vulnerable surface area to the
// Web.config file, which can be secured with an ACL.
// User name
string userName =
ConfigurationManager.AppSettings
["MyReportViewerUser"];
if (string.IsNullOrEmpty(userName))
throw new Exception(
"Missing user name from web.config file");
// Password
string password =
ConfigurationManager.AppSettings
["MyReportViewerPassword"];
if (string.IsNullOrEmpty(password))
throw new Exception(
"Missing password from web.config file");
// Domain
string domain =
ConfigurationManager.AppSettings
["MyReportViewerDomain"];
if (string.IsNullOrEmpty(domain))
throw new Exception(
"Missing domain from web.config file");
return new NetworkCredential(userName, password, domain);
}
}
public bool GetFormsCredentials(out Cookie authCookie,
out string userName, out string password,
out string authority)
{
// not use FormsCredentials unless you have implements a custom autentication.
authCookie = null;
userName = null;
password = null;
authority = null;
// Not using form credentials
return false;
}
}
而在RsReportServer.config
文件我修改,取而代之的<authentication>
节点:
<Authentication>
<AuthenticationTypes>
<Custom />
</AuthenticationTypes>
<EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>
而且在web.config
文件的reportserver的我改变身份验证的形式和假冒为假,我在reportmanager的web.config
文件中做了同样的事情。
任何遗漏。或者我是对的?
我也猜我需要做一些与CustomSecurity扩展术语?
答
搜索上
http://blogs.msdn.com/b/bimusings/archive/2005/12/05/500195.aspx
虽然这是老 - 这应该是对的东西,使其工作的检查列表一个很好的参考。
答
您必须配置您的SSRS服务(位于服务器上),与开始的帮助 - >所有程序 - >微软SQL服务器2008 - >配置工具 - > Reporting Services配置管理器(SSRS)
第一眼看起来你的代码没问题。我最好的建议是帮助你了解更多信息,并帮助我们更好地理解问题。取出注释行,用硬编码的字符串替换AppSettings等:尽可能缩小示例。 – Jeroen 2012-08-07 10:42:23
现在我的本地计算机中的表单身份验证运行良好..(即时通讯使用活动目录uname和pwd作为凭据..错误是因为我通过的凭据是不正确的)现在,当我试图查看应用程序另一台计算机(两台计算机在网络中)即,报告服务器在我的电脑中..我得到了同样的错误.. – neeranzan 2012-08-12 04:55:37