实现接口
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;