将当前网页捕获为图像文件并保存到服务器的文件夹中 [英] Capture Current webpage as Image file and save into folder at server

查看:80
本文介绍了将当前网页捕获为图像文件并保存到服务器的文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







当我运行项目并点击按钮时,我想捕获当前网页并保存为文件夹中的图像。这在localhost中成功运行,但是当我发布项目时,它会在服务器中保存黑色图像而不是真实图像。



CopyFromScreen函数在服务器运行时出错。 />
错误:句柄无效。

Hi,


when I run my project and click on button at that time i want to capture current webpage and save as image in Folder. This is run succcessfully in localhost but when i publish project then it save Black Image instead of real image in server.

CopyFromScreen function gets error at runtime in server.
Error: The handle is invalid.

推荐答案

你不能。

出现 在开发中工作,因为客户端和服务器是同一台计算机:因此可以从屏幕上复制。

如果它在生产中有效,你就不会得到客户端显示的图像,您将获得 服务器 显示的图像,该图像不会显示任何网页。



确切地说,你得到的将取决于客户使用什么浏览器来显示网页!



出于安全原因你无法访问客户端屏幕在99.999%的情况下 - 例外只有IE,允许ActiveX控件,启用ActiveX控件 - 并且由于最后两个被禁止默认情况下,IE现在是少数浏览器,你几乎肯定无法做到这一点。



想一想:如果你能做到,恶意网站也可以跟踪您的操作,如何访问您的银行帐户,...
You can't.
It appears to work in development because the client and the server are the same computer: so copying from the screen is possible.
If it worked in production, you would not get an image of the client display, you would get an image of the server display, which will not show any web pages.

And exactly what you would get would depend on what browser the client is using to display the webpage!

You cannot access the client screen for security reasons in 99.999% of cases - the exception being IE only, ActiveX controls allowed, ActiveX controls enabled - and since the last two are disallowed by default, and IE is a "minority" browser these days, you will almost certainly not be able to do this.

Think about it: if you could do it, so could malicious sites that want to track what you do, how you access your bank account, ...


这篇关于将当前网页捕获为图像文件并保存到服务器的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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