ASP.Net,捕获客户端错误的图像/截图

时间:2022-06-17 20:30:16

We currently have fairly robust error handling functionality in our ASP.Net application.

我们目前在ASP.Net应用程序中具有相当强大的错误处理功能。

We log all errors in the database, a text file on the server and also send automated emails containing the error details back to our support people.

我们记录数据库中的所有错误,服务器上的文本文件,并将包含错误详细信息的自动电子邮件发送回我们的支持人员。

This all happens on the server of course.

这一切都发生在服务器上。

We would like to capture (and retrieve) an image of the client browser at the time the error occurred to provide additional info for troubleshooting?

我们希望在发生错误时捕获(并检索)客户端浏览器的图像,以提供其他疑难解答信息?

Is this at all possible?

这是可能吗?

If so what would be an elegant approach to this problem?

如果是这样,这个问题的优雅方法是什么?

3 个解决方案

#1


This is not technically impossible, but it is so impractical for nearly all purposes that it might as well be impossible. You would need a plugin running on the client's machine which can receive instructions from your error page to take the screenshot, connect to the server and upload it.

这在技术上并不是不可能的,但对于几乎所有目的而言,它实际上是不可能的。您需要在客户端的计算机上运行一个插件,该插件可以从您的错误页面接收指令以获取屏幕截图,连接到服务器并上传它。

If your client screens have complex data which affects the state surrounding the exception, you should revisit your design to ensure all of that is recorded before it's sent to the client, so you can keep all relevant state tracked with a given exception.

如果您的客户端屏幕具有影响异常周围状态的复杂数据,则应重新检查您的设计以确保在将其发送到客户端之前记录所有内容,以便您可以使用给定的异常跟踪所有相关状态。

#2


Saying something is "impractical" is usually easier than actually trying to solve something that is difficult, but not technically impossible.

说某事“不切实际”通常比实际尝试解决困难的事情更容易,但在技术上却不可能。

I have done some more research and have come across an approach that allows one to get hold of the rendered html server side.

我做了一些更多的研究,并且遇到了一种允许人们掌握渲染的html服务器端的方法。

Further more, there are ways to also convert html to images

此外,还有一些方法可以将html转换为图像

I will implement the solution using a combination of the two.

我将使用两者的组合来实现解决方案。

#3


Capturing a client browser screenshot is not possible due to security and privacy reasons. What you can (and imho you should) do is capture the url and the browser version and try to reproduce it in the same environment.

由于安全和隐私原因,无法捕获客户端浏览器屏幕截图。您可以(以及您应该做的)捕获网址和浏览器版本并尝试在同一环境中重现它。

#1


This is not technically impossible, but it is so impractical for nearly all purposes that it might as well be impossible. You would need a plugin running on the client's machine which can receive instructions from your error page to take the screenshot, connect to the server and upload it.

这在技术上并不是不可能的,但对于几乎所有目的而言,它实际上是不可能的。您需要在客户端的计算机上运行一个插件,该插件可以从您的错误页面接收指令以获取屏幕截图,连接到服务器并上传它。

If your client screens have complex data which affects the state surrounding the exception, you should revisit your design to ensure all of that is recorded before it's sent to the client, so you can keep all relevant state tracked with a given exception.

如果您的客户端屏幕具有影响异常周围状态的复杂数据,则应重新检查您的设计以确保在将其发送到客户端之前记录所有内容,以便您可以使用给定的异常跟踪所有相关状态。

#2


Saying something is "impractical" is usually easier than actually trying to solve something that is difficult, but not technically impossible.

说某事“不切实际”通常比实际尝试解决困难的事情更容易,但在技术上却不可能。

I have done some more research and have come across an approach that allows one to get hold of the rendered html server side.

我做了一些更多的研究,并且遇到了一种允许人们掌握渲染的html服务器端的方法。

Further more, there are ways to also convert html to images

此外,还有一些方法可以将html转换为图像

I will implement the solution using a combination of the two.

我将使用两者的组合来实现解决方案。

#3


Capturing a client browser screenshot is not possible due to security and privacy reasons. What you can (and imho you should) do is capture the url and the browser version and try to reproduce it in the same environment.

由于安全和隐私原因,无法捕获客户端浏览器屏幕截图。您可以(以及您应该做的)捕获网址和浏览器版本并尝试在同一环境中重现它。