1) Business Intelligence Report:
2) Deployment of the Report on the Report Server.
3) Reporting in ASP.NET:
protected void btnReport_Click(object sender, EventArgs e)
{
ReportParameter[] parm = new ReportParameter[1];
parm[0] =new ReportParameter("deptno",txtDeptno.Text);
ReportViewer1.ShowCredentialPrompts = false;
ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials("Reportfolder Name", "Password of the folder", "");
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://ReportServer/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/ReportFolder/ReportName";
ReportViewer1.ServerReport.SetParameters(parm);
ReportViewer1.ServerReport.Refresh();
}
In the above code ReportParameter are the report parameters used to display the report.
ReportFolderName is the folder where we have deployed the report on the Report server.
Password of the Folder this is the password for that folder on the report server.
Next step is about the class,
which implements the Microsoft.Reporting.WebForms.IReportServerCredentials
interface for accessing the reports.
public class ReportCredentials : Microsoft.Reporting.WebForms.IReportServerCredentials
{
string _userName, _password, _domain;
public ReportCredentials(string userName, string password, string domain)
{
_userName = userName;
_password = password;
_domain = domain;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get
{
return null;
}
}
public System.Net.ICredentials NetworkCredentials
{
get
{
return new System.Net.NetworkCredential(_userName, _password, _domain);
}
}
public bool GetFormsCredentials(out System.Net.Cookie authCoki, out string userName, out string password, out string authority)
{
userName = _userName;
password = _password;
authority = _domain;
authCoki = new System.Net.Cookie(".ASPXAUTH", ".ASPXAUTH", "/", "Domain");
return true;
}
}
This class is mainly used for passing the report credentials to access the report.
Next step is to click the button and the report is displayed.
This is the process to access the SQL Server Reporting Services in the ASP.NET.