在客户端保存文本文件而无需随时请求许可
我需要在客户端保存一个文本文件,可能未经许可。情况是我需要将此文本文件保存在本机或局域网中另一台计算机的共享文件夹中。该文本文件将由将打印财务发票的财务打印机自动读取。我有一个asp .net Web应用程序,并且服务器与财务打印机不在同一局域网上,所以我必须在客户端编写它。知道如何做到这一点,而不需要每次都询问用户安全问题。 我需要一个跨浏览器的解决方案。
我可以接受这样的解决方案:第一次打印时只询问客户一次,但不是每次他想打印账单时都会询问。向客户请求某种允许该网站的许可,以免重复请求许可。
I need to save a text file on the client side possibly without permission. The case is that I need to save this text file in a shared folder in this or in another machine in the lan. This text file is going to be read automatically by the fiscal printer which will print the fiscal invoice. I have a asp .net web application and the server is not on the same lan with the fiscal printer, so I have to write it on the client-side. Any idea how to do this without asking to the user every time for the security issue.
I need a cross browser solution.
I can accept a solution like, the client is asked only one time a the first printing, but not every time he wants to print a bill. Some kind of asking permission to the client for allowing this website, in order to not repeat the permission asking.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
显然,在用户不知情的情况下将文件下载到他们的计算机上将是一个重大的安全漏洞。所有浏览器都有预防措施来防止这种情况发生。
Obviously - this would be a major security breach to download files to the user's computer without them knowing. All browsers have precautions in place to prevent this from happening.
不,你不能这样做。不允许将文件保存到未经许可的计算机的公共文件夹中。
但是,您可以让您的客户安装您的应用程序,该应用程序将能够在您想要的位置读写。
木马病毒对此的常见方式是让客户端运行一些愚蠢的程序来显示烟花表演或其他非常琐碎的东西。当客户忙着想知道他在看什么时,您的病毒正在后台悄悄安装。
现在,您可能会对自己说:“但我没有安装病毒。”但是,浏览器无法知道您的应用程序是否是病毒。这就是为什么它是不允许的,也是为什么你不能这样做的原因。
No, you can not do this. Saving a file to a computer without permission in a public folder is not allowed.
You can, however, have your Client install your application which will have the ability to read and write where you want.
A common way that Trojan viruses to this is by giving the Client some goofy program to run that displays a fireworks show or something else quite trivial. While the Client is busy wondering what he's looking at, your virus is installing quietly in the background.
Now, you are probably saying to yourself, "But I am not installing a virus." However, there is no way for a Browser to know if your application is a virus or not. That is why it is not allowed and why you can not do it.
对我来说更适用的场景是:
1- 在 Web 应用程序中完成工作。
2- 获取您需要打印的信息。
3- 将其直接发送到另一台计算机(或托管的 Web 服务),该计算机将充当这些文件的主机。
4-让您的服务器访问此共享文件夹,并打印您想要的内容
The more applicable scenario for me is:
1- Do your work inside your web application.
2- Get the information that you need to print.
3- Send it to another computer directly (or to a hosted web service) and this computer will act as a host for these files.
4- let your server access this shared folder, and print what you want
您可以使用 cookie,它不会请求许可。当然,这只有在启用 cookie 并且可以存储有限数量的数据时才有效。
You could use a cookie, which won't ask permission. Of course that would only work when cookies are enabled and can store limited amounts of data.