阻止用户下载报告 [英] Prevent user from downloading report

查看:46
本文介绍了阻止用户下载报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我的业主要求阻止用户下载报告。

现在我正在显示我的报告在浏览器中使用以下代码:

Dear,

I have a request from my Business owner to prevent user from downloading report.
Now i am displaying my report in browser using the following code:

private void DisplayReportInBrowser()
        {
            // Variables
            Warning[] warnings;
            string[] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension1 = string.Empty;

            // Setup the report viewer object and get the array of bytes
            byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension1, out streamIds, out warnings);
            Response.Clear();
            Response.ContentType = mimeType;
            Response.Cache.SetCacheability(HttpCacheability.Private);
            Response.Expires = -1;
            Response.Buffer = true;
            Response.AppendHeader("Content-Disposition", "inline; filename=Testing");
            Response.BinaryWrite(bytes);
            Response.End();
        }





但是我无法禁用在浏览器中呈现的下载按钮。

有什么方法可以实现吗?



我尝试过的事情:



i试图禁用下载按钮,但它不起作用。



but i can't disable the download button which is rendered in browser.
Is there is any way to achieve that?

What I have tried:

i tried disabling the download button but it didn't work.

推荐答案

你必须明白,你在网页上显示的那一刻内容是在最终用户的机器上...

因此,即使您阻止在报告后面下载pdf文件,最终用户也可以逐页保存(如分页和点击'打印屏幕'),所以报告就在那里......

如果你想要防止这种情况,那么使用经过身份验证的网站或发送报告只有人们才能使用电子邮件。 。

如SA建议的那样:由于您无法阻止最终用户在浏览器显示报告时保留报告中的信息,您可以合作nsider使用某种身份验证方法缩小可以这样做的人数,或者通过电子邮件将报告发送给具有适当权利的人...
You have to understand, that the very moment you display something on a web page that content is on the end user's machine...
So even you prevent from downloading the pdf file behind the report, the end user can save it page-by-page (like paging and hitting 'Print Screen'), so the report is there...
If you want to prevent such situation, than use an authenticated site or send out the report only the people can have it using email...
As SA suggested: As you cannot prevent the end user from keeping the information in the report at the moment it was displayed by the browser, you may consider narrowing down the number of persons who can do so by using some authentication method or by sending out the report only to people with proper rights, using e-mail…


这篇关于阻止用户下载报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆