Forum Discussion
floshdraw
7 years agoNew Member
Error on Report Viewer with Power BI Report Server
Hello all,
I'm testing some ways to embed Power BI reports which store on Power BI Report Server and I am developping a web page in asp.net to view a report.
I have successfully connected to my reports I believe but I have a message "Request failed with empty response" when I get report.
All is ok when I connect directly on browser on portal.
Do you have some ideas about this one ?
Find asp class
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Security.Principal;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ReportViewer_PowerBI
{
public partial class WebForm1 : System.Web.UI.Page
{
private String username;
private String pwd;
private String report;
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
}
protected void Button1_Click(object sender, EventArgs e)
{
username = this.txtUser.Text;
pwd = this.txtPassword.Text;
report = this.txtReport.Text;
ReportViewer1.Reset();
ReportViewer1.ServerReport.ReportServerCredentials = new CustomReportCredentials(username, pwd, "XX");
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://myReport");
ReportViewer1.ServerReport.ReportPath = "/" + report;
//ReportViewer1.ServerReport.Refresh();
}
}
///
/// Summary description for CustomReportCredentials
///
public class CustomReportCredentials :
Microsoft.Reporting.WebForms.IReportServerCredentials
{
// 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 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;
}
}
}And also form web
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Height="297px">
<ServerReport />
</rsweb:ReportViewer>
<p>
User<asp:TextBox ID="txtUser" runat="server"></asp:TextBox>
</p>
<p id="txtPwd">
Password<asp:TextBox ID="txtPassword" runat="server" style="margin-bottom: 0px"></asp:TextBox>
</p>
<p>
Report<asp:TextBox ID="txtReport" runat="server" style="margin-bottom: 4px"></asp:TextBox>
</p>
<p>
<asp:Button ID="btnVal" runat="server" OnClick="Button1_Click" Text="Load" />
</p>
</form>
</body>Thanks
1 Reply
- AnonymousNot applicable
You got any solution for this issue, I am also facing same issue..