求助!使用 ReportViewer 控件集成 Reporting Services2008 时,报"...401 unauthorized"错误!

实现接口

public class ReportServiceCredetials : Microsoft.Reporting.WebForms.IReportServerCredentials
{

public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority)
{
authCookie = null;
userName = null;
password = null;
authority = null;
return false;
}

public WindowsIdentity ImpersonationUser
{
get { return null; }
}

public ICredentials NetworkCredentials
{
get { return new NetworkCredential("username", "password", "domainname"); }
}
}

//使用

ReportServiceCredetials rpCredentials = new ReportServiceCredetials();
rv.ServerReport.ReportServerCredentials = (Microsoft.Reporting.WebForms.IReportServerCredentials)rpCredentials;

原文地址:https://www.cnblogs.com/jeffry/p/7130644.html