我对SSRS身份验证有疑问。我已在实时服务器上部署了我的报告,在使用实时URL访问这些报告后,它显示了#34;身份验证失败"错误。我的目的是宇宙中的任何人都可以访问报告,但我该怎么做?即让每个人都访问该特定URL以查看报告。 我在这里使用SQL Server身份验证。
当我在本地服务器上运行该应用程序时运行正常,因为它有权访问该报告,但当我尝试访问实时服务器上的报告时,故事就开始了。
提前致谢
答案 0 :(得分:0)
如果你想让公众指责你的报告,你需要使用报告查看器控制,而这是一个很长的过程,允许报告服务器公开访问。所以很容易就是为什么。
创建新页面并在表单标记中显示以下代号
<rsweb:ReportViewer ID="MainReportViewer" runat="server" BackColor="White"
Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos=" (Collection)"
ProcessingMode="Remote" ShowBackButton="False" ShowFindControls="False"
ShowPageNavigationControls="False" SizeToReportContent="True"
ToolBarItemBorderColor="White" ToolBarItemHoverBackColor="White"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="100%">
<ServerReport
ReportServerUrl="" />
</rsweb:ReportViewer>
下面的代码可以帮助您设置报告路径,用户名,密码等,有助于控制您的报告,请将以下代码放到CA文件中
protected void Page_Init(Object sender,EventArgs e) {
string UserName = ConfigurationManager.AppSettings["SsrsUserName"];
string Password = ConfigurationManager.AppSettings["SsrsPassword"];
string Domain = ConfigurationManager.AppSettings["SsrsDomain"];
string ReportServerRoot = ConfigurationManager.AppSettings["SsrsServerRoot"];
string ReportServerPath = ConfigurationManager.AppSettings["SsrsReportServerPath"];
MainReportViewer.ProcessingMode = ProcessingMode.Remote;
IReportServerCredentials irsc = new CustomReportCredentials(UserName, Password, Domain);
MainReportViewer.ServerReport.ReportServerCredentials = irsc;
MainReportViewer.ServerReport.ReportServerUrl = new Uri(ReportServerRoot);
MainReportViewer.ServerReport.ReportPath = ReportServerPath + "YourReportFileName";
}
答案 1 :(得分:0)
抱歉延迟回复。请找到customreportcreadentials类: - 公共类CustomReportCredentials:Microsoft.Reporting.WebForms.IReportServerCredentials { 私有字符串_UserName; 私人字符串_PassWord; 私有字符串_DomainName;
public CustomReportCredentials(string UserName, string PassWord, string DomainName)
{
_UserName = UserName;
_PassWord = PassWord;
_DomainName = DomainName;
}
public CustomReportCredentials(string UserName, string PassWord)
{
_UserName = UserName;
_PassWord = PassWord;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get { return null; }
}
public ICredentials NetworkCredentials
{
get { return new NetworkCredential(_UserName, _PassWord, _DomainName); }
}
public bool GetFormsCredentials(out Cookie authCookie, out string user,
out string password, out string authority)
{
authCookie = null;
user = password = authority = null;
return false;
}
}