如何在ASP.NET中扫描和保存图片? [英] How to scan and save picture in ASP.NET?

查看:77
本文介绍了如何在ASP.NET中扫描和保存图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在构建一个WebApp,该WebApp必须在客户端上使用扫描仪,扫描图片,将其保存在服务器上,并将有关图片的一些数据保存在数据库中.
我已经在Windows窗体应用程序中使用WIA做到了,但是如何在ASP.NET中使用它呢?

Hi guys,
I''m building a WebApp that has to use scanner on client, scan a picture, save it on server and save some data about picture in database.
I''ve done it using WIA with windows forms app, but how to use it with ASP.NET?

推荐答案

直接来说,你做不到.当您考虑它时,您会明白为什么-浏览器被沙箱化,以防止其对您的计算机的不安全访问.

有两种潜在的解决方案,但它们有些笨拙,不安全,并且仅使用Windows计算机依赖您的客户端.

第一个解决方案是编写一个ActiveX组件,该组件将安装在网页上,并且可以在浏览器沙箱外部进行访问.

第二种解决方案是使用ClickOnce将Windows Forms应用程序下载到客户端PC并使用它扫描图像.使用此解决方案,您需要在服务器端提供Web服务以允许应用程序编写映像返回到-您还需要确保每次都下载了该应用程序(因此您将其设置为不安装在PC上),并且希望将查询字符串传递给该应用程序确定要为其保存记录的客户端.
Directly speaking, you can''t. When you think about it, you''ll see why - your browser is sandboxed to prevent it getting unsecured access to your machine.

There are a couple of potential solutions, but they are hackish, unsecure, and rely on your clients only using Windows machines.

The first solution is to write an ActiveX component which will be installed on the web page, and can get access outside the browser sandbox.

The second solution is to use ClickOnce to download an Windows Forms application to the client PC and use that to scan the image in. With this solution, you''d need to provide a web service at the server end to allow the application to write the image back to - you''d also need to ensure that the application was downloaded every time (so you''d set it up not to install on the PC), and you''d want to pass a querystring to it to identify the client you''re saving the records for.


Peter绝对正确.

除了他说的话,我还能说出什么是唯一可以接受的解决方案.我像一个用户那样讲.建议用户独立扫描文档,然后在Web表单上发布位图文件(PNG,JPG).如果用户有扫描仪,则他或他应该知道如何扫描.允许访问我的扫描仪是不安全的.

—SA
Peter is absolutely right.

In addition to what he says, I can tell what is the only acceptable solution. I''m telling this like a user. The user should be advised to scan a document independently and post a bitmap file (PNG, JPG) on the Web form. If the user has a scanner, she or he is supposed to know how to scan. Allowing to access my scanner is unsafe.

—SA


这篇关于如何在ASP.NET中扫描和保存图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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