从IIS配置Web应用程序时,从剪贴板粘贴图像不起作用

时间:2022-09-03 20:16:28

Am creating a web based application using ASP.NET v2.0. I have a requirement in my project to have a control in my web page that would allow the users to enter text or copy paste image from the clipboard (say a snapshot).

我正在使用ASP.NET v2.0创建基于Web的应用程序。我的项目中要求在我的网页中设置一个控件,允许用户输入文本或从剪贴板复制粘贴图像(比如快照)。

In order to achieve the same I have tried using the windows clipboard class in web forms and retrieved the clipboard image and stored the same in Sql Server DB. On click of the button, the corresponding image is fetched and displayed to the end user.

为了实现相同的目的,我尝试在Web表单中使用Windows剪贴板类并检索剪贴板图像并将其存储在Sql Server DB中。单击该按钮,将获取相应的图像并显示给最终用户。

All this works fine when running through IDE. When I host my web app in IIS, am not able to achieve the same. Pasting the image from the clipboard on a button click doesn't work.

通过IDE运行时,所有这一切都正常。当我在IIS中托管我的Web应用程序时,我无法实现相同的目标。在按钮单击上粘贴剪贴板中的图像不起作用。

Any ideas?

1 个解决方案

#1


You can't use the windows clipboard class directly on a web application.

您不能直接在Web应用程序上使用Windows剪贴板类。

You could have the user copy some data from the clipboard to an input control and post that data through a postback or an AJAX. Or you could get the data from the clipboard with a client tool like a custom ActiveX control.

您可以让用户将一些数据从剪贴板复制到输入控件,并通过回发或AJAX发布该数据。或者您可以使用客户端工具(如自定义ActiveX控件)从剪贴板获取数据。

My guess is that when it works through the IDE, the information is getting through a "back door". Since everything is happening on the same system, the correct information happens to be in the Windows clip board.

我的猜测是,当它通过IDE运行时,信息正在通过“后门”。由于所有事情都发生在同一系统上,因此正确的信息恰好出现在Windows剪贴板中。

#1


You can't use the windows clipboard class directly on a web application.

您不能直接在Web应用程序上使用Windows剪贴板类。

You could have the user copy some data from the clipboard to an input control and post that data through a postback or an AJAX. Or you could get the data from the clipboard with a client tool like a custom ActiveX control.

您可以让用户将一些数据从剪贴板复制到输入控件,并通过回发或AJAX发布该数据。或者您可以使用客户端工具(如自定义ActiveX控件)从剪贴板获取数据。

My guess is that when it works through the IDE, the information is getting through a "back door". Since everything is happening on the same system, the correct information happens to be in the Windows clip board.

我的猜测是,当它通过IDE运行时,信息正在通过“后门”。由于所有事情都发生在同一系统上,因此正确的信息恰好出现在Windows剪贴板中。