通过WebClient byte[]或其他方式在Silverlight应用程序中安全地呈现SSRS报告
我正在尝试在Silverlight 5应用程序中实现SSRS报告功能,该应用程序在浏览器模式下运行 尝试1) 最初的计划是在Silverlight客户端上使用URL技术呈现页面通过WebClient byte[]或其他方式在Silverlight应用程序中安全地呈现SSRS报告,silverlight,reporting-services,webclient,Silverlight,Reporting Services,Webclient,我正在尝试在Silverlight 5应用程序中实现SSRS报告功能,该应用程序在浏览器模式下运行 尝试1) 最初的计划是在Silverlight客户端上使用URL技术呈现页面 var path = item.Path; // Where item.Path is something like '/MyReportFolder/Report1' var url= @"http://<MyServerAddress>/ReportServer/Pages/ReportViewer.as
var path = item.Path; // Where item.Path is something like '/MyReportFolder/Report1'
var url= @"http://<MyServerAddress>/ReportServer/Pages/ReportViewer.aspx?{0}&rs:Command=Render";
var completeUrl = string.Format(url, path.Replace(@"/", "%2f").Replace(" ", "+"));
System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(completeUrl), "_newWindow", "toolbar=0,menubar=0,resizeable=1,scrollbars=1");
var path=item.path;//其中item.Path类似于“/MyReportFolder/Report1”
var url=@”http:///ReportServer/Pages/ReportViewer.aspx?{0}&rs:Command=Render”;
var completeUrl=string.Format(url,path.Replace(@“/”,“%2f”).Replace(“,”+”);
System.Windows.Browser.HtmlPage.Window.Navigate(新Uri(completeUrl),“\u newWindow”,“工具栏=0,菜单栏=0,可调整大小=1,滚动条=1”);
这里的问题是调用此URL的权限将很难管理,并且与Silverlight应用程序运行时的基本安全性无关
尝试2)
通过WebClient中类似的Url调用在IIS服务器上(而不是在客户端上,通过WCF调用代表用户)呈现报告,并下载字节[]输出,然后将字节[]发送到Silverlight客户端(作为对WCF调用的响应),然后在Silverlight应用程序中呈现内容
var path = itemPath;
var url = @"http://<MyServerAddress>/ReportServer/Pages/ReportViewer.aspx?{0}&rs:Command=Render";
var completeUrl = string.Format(url, path.Replace(@"/", "%2f").Replace(" ", "+"));
var tcs = new TaskCompletionSource<byte[]>();
var webClient = new WebClient();
webClient.DownloadDataCompleted += (sender, args) => tcs.TrySetResult(args.Error != null ? args.Result : new byte[0]);
webClient.DownloadDataAsync( new Uri(completeUrl));
return tcs.Task;
var path=itemPath;
var url=@”http:///ReportServer/Pages/ReportViewer.aspx?{0}&rs:Command=Render”;
var completeUrl=string.Format(url,path.Replace(@“/”,“%2f”).Replace(“,”+”);
var tcs=new TaskCompletionSource();
var webClient=新的webClient();
webClient.DownloadDataCompleted+=(发送方,args)=>tcs.TrySetResult(args.Error!=null?args.Result:新字节[0]);
DownloadDataAsync(新Uri(completeUrl));
返回tcs.Task;
还可以很好地将报告呈现为字节[],并且可以通过WCF服务操作调用轻松处理安全性。但是,一旦客户端接收到字节[],我就不知道如何在屏幕上显示结果。我的首选方法是打开一个新的浏览器窗口并将内容呈现到其中,但是System.Windows.browser.HtmlPage.window不支持此操作
因此,我的选择是: