protected void bnt_click1(object sender, EventArgs e)
{
ReportViewer1.Width = 800;
ReportViewer1.Height = 600;
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
IReportServerCredentials irsc = new CustomReportCredentials("username", "password", "someserver:8080/Reports"); // e.g.: ("demo-001", "123456789", "ifc")
ReportViewer1.ServerReport.ReportServerCredentials = irsc;
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://someserver:8080/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/Masha/Returns"; //e.g.: /demo-001/test
ReportViewer1.ServerReport.Refresh();
}
public class CustomReportCredentials : IReportServerCredentials
{
private string _UserName;
private string _PassWord;
private string _DomainName;
public CustomReportCredentials(string UserName, string PassWord, string DomainName)
{
_UserName = UserName;
_PassWord = PassWord;
_DomainName = DomainName;
}
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;
}
}
我正在尝试在ASP.Net Project中嵌入SSRS报告查看器。我正在尝试连接到在报表查看器中显示报表的远程SSRS报表服务器。对于身份验证部分,我得到了这个:
401未经授权的错误
如何删除身份验证或绕过它?
我可以使用登录凭据通过Web浏览器访问报表服务器。