Hi,
To display reports deployed to a SQL Azure Reporting report server in the ReportViewer controls, you should supply the report server URL and the report path as you would for any server report, and implement the IReportServerCredentials interface and use
it in ServerReport.ReportServerCredentials.
The following example shows how to implement and use the IReportServerCredentials to access SQL Azure Reporting reports:
public partial class Default : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
ReportViewer1.ServerReport.ReportServerUrl = new Uri(String.Format("https://{0}/reportserver", ConfigurationManager.AppSettings["SERVER_NAME"]));
ReportViewer1.ServerReport.ReportPath = ConfigurationManager.AppSettings["REPORT_PATH"];
ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials();
}
}
/// <summary>
/// Implementation of IReportServerCredentials to supply forms credentials to SQL Azure Reporting using GetFormsCredentials()
/// </summary>
public class ReportServerCredentials : IReportServerCredentials
{
public ReportServerCredentials()
{
}
public WindowsIdentity ImpersonationUser
{
get
{
return null;
}
}
public ICredentials NetworkCredentials
{
get
{
return null;
}
}
public bool GetFormsCredentials(out Cookie authCookie, out string user, out string password, out string authority)
{
authCookie = null;
user = ConfigurationManager.AppSettings["USERNAME"];
password = ConfigurationManager.AppSettings["PASSWORD"];
authority = ConfigurationManager.AppSettings["SERVER_NAME"];
return true;
}
}
Then, in the Web.config or App.config file, specify the application settings in the <appSettings> element.
<appSettings>
<add key="SERVER_NAME" value="<INSTANCE_NAME>.report.int.mscds.com" />
<add key="USERNAME" value="<USERNAME>"/>
<add key="PASSWORD" value="<PASSWORD>"/>
<add key="REPORT_PATH" value="<REPORT_PATH>"/>
</appSettings>
For more information on the IReportServerCredentials interface, see the corresponding API reference topic in
ReportViewer Controls Programming Reference on MSDN. For Windows Forms applications, use the
Microsoft.Reporting.Winforms Namespace. For ASP.NET applications, use the
Microsoft.Reporting.Webforms Namespace..
See Security Considerations for information on how to secure sensitive data like report server URL, username, and password.
Challen Fu
TechNet Community Support
