我试图将aspx页面转换为图像,即将其另存为png文件。我为此使用了iecapt。我在aspx页面上有很多文本框。问题是文本框值未保存在图像文件中。我只是获取源文件图像。希望我对此有一些建议。谢谢
受保护的无效btnsend_Click(对象发送器,事件参数 e) {
string url = "http://localhost:4101/WebForm3.aspx";
if(Request.Params["weburl"] != null)
{
url = Request.Params["weburl"];
}
string savepath = String.Format("C:\IECapt\{0}.png" , System.Guid.NewGuid());
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = "C:\IECapt\IECapt.exe";
process.StartInfo.Arguments = String.Format(""{0}" "{1}"",url,savepath);
process.StartInfo.UseShellExecute = false;
process.Start();
process.WaitForExit();
process.Dispose();
Response.Clear();
Response.ContentType = "image/png";
Response.WriteFile(savepath);
Response.End();
}
The problem is the textbox values are not saved in the image file.
当然不是,如果他们这样做,那么每个人都将能够读出输入的数据 - 但事实并非如此,情况是您加载的页面不包含任何输入的数据 - 是一个隔离加载。
当你这样做时,你加载了用户看到的东西,但实际上没有,你看不到用户看到的东西,你只是再加载一次页面。
必须区分在服务器上运行的代码和在客户端浏览器上运行的代码。
你也问同样的问题:asp.net c# 中的网页屏幕截图