简体   繁体   English

如何防止保存文件ASP.NET MVC 4应用程序

[英]How to prevent saving files asp.net mvc 4 application

I 'm currently working on creating a web learning portal using ASP.NET MVC 4, where my clients requirement is that the end user should not be able to save the file. 我目前正在使用ASP.NET MVC 4创建一个Web学习门户,我的客户要求最终用户不应保存该文件。 The save restriction is applicable on all video type files, images, pdf, word docs and powerpoint type files. 保存限制适用于所有视频类型文件,图像,pdf,word docs和powerpoint类型文件。

I understand the following exceptions and the client is good with this: 我了解以下例外情况,客户对此表示满意:

  1. User can make use of print screen 用户可以使用打印屏幕
  2. copy-paste text 复制粘贴文本

I need your guidance how best to accomplish this. 我需要您的指导,以最好的方式做到这一点。

For video, I came across the following link http://www.strathweb.com/2013/01/asynchronously-streaming-video-with-asp-net-web-api/ . 对于视频,我遇到了以下链接http://www.strathweb.com/2013/01/asynchronously-streaming-video-with-asp-net-web-api/

Thanks, Hemant. 谢谢,赫曼特。

I came across this online tool http://www.docspal.com/ but they doesn't seems to provide any API for the developers. 我遇到了这个在线工具http://www.docspal.com/,但他们似乎没有为开发人员提供任何API。

Am I the only one with this requirement :( 我是唯一有此要求的人吗?

It is really hard to stop users from copying documents from the website. 确实很难阻止用户从网站复制文档。

However, just to lower it down, you should be able to disable right click which may at least decrease the number of users that will try to copy your content. 但是,只是降低它,您应该能够禁用右键单击,这至少可以减少尝试复制您的内容的用户数量。 Do something like following in jQuery. 在jQuery中执行以下操作。

$(document).bind('contextmenu', function (e) {
  e.preventDefault();
  alert('Right Click is not allowed');
});

Refer to this for more. 请参阅为多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM