截取网页的屏幕截图 [英] taking Screen Shot of the web page

查看:79
本文介绍了截取网页的屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在截取页面的屏幕快照,并将其保存在服务器中的文件中.
在我的本地计算机上,它工作正常.但是当我托管在服务器上时,

有异常

Hi all,

I am taking screen shot of the page and saving in a file in the server.
in my Local Machine it works fine. but when i hosted in server ,

got exception

"Handle is Invalid"



然后尝试将图像保存在数据库中.这里也以本地图像的形式存储和检索.但在托管站点中仅显示阻止屏幕.


我已使用此代码





then tried saving the image in DB. here too in local image is stored and retrieved. but in hosted site only block screen is displayed.


i have used this code



Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
           Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
           graphics.CopyFromScreen(25, 25, 25, 25, bitmap.Size);
           bitmap.Save( System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "Uploads\\myscreenshot.bmp", ImageFormat.Bmp);




该如何解决?




在此先感谢...




How to resolve this?




Thanks in Advance...

推荐答案



不确定.但是如果上传,您是否会在构建地址前面时缺少反斜线?

Hi,

Not sure..but are you missing back slash in building the adress infront if upload??

bitmap.Save( System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "\Uploads\\myscreenshot.bmp", ImageFormat.Bmp); 



希望对您有所帮助.



Hope it helps.


通过此链接,可能会对您有所帮助

此处 [
Go through this link , this may helps you

Here[^]

Thanks
--RA


这篇关于截取网页的屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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