using System; using DotNetNuke.Entities.Modules; using System.Net; namespace ReportServicesViewer { public partial class View : PortalModuleBase { protected void Page_Load(object sender, EventArgs e) { ReportViewer1.Width = 500; ReportViewer1.Height = 500; ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; Microsoft.Reporting.WebForms.IReportServerCredentials irsc = new CustomReportCredentials("ReportUser", "password", "Mydomain"); ReportViewer1.ServerReport.ReportServerCredentials = irsc; ReportViewer1.ServerReport.ReportServerUrl = new Uri(@"http://localhost/ReportServer/"); ReportViewer1.ServerReport.ReportPath = "/Models/EventLogReport"; ReportViewer1.ServerReport.Refresh(); } } } public class CustomReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials { // From: http://community.discountasp.net/default.aspx?f=14&m=15967 // local variable for network credential. 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; // not use ImpersonationUser } } public ICredentials NetworkCredentials { get { // use NetworkCredentials return new NetworkCredential(_UserName, _PassWord, _DomainName); } } public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority) { // not use FormsCredentials unless you have implements a custom autentication. authCookie = null; user = password = authority = null; return false; } }