Click here to Skip to main content
13,050,617 members (92,473 online)
Rate this:
Please Sign up or sign in to vote.
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?
Posted 4-May-11 9:06am
SAKryukov 5-May-11 11:32am
Thanx guys. I was afraid of such answer Big Grin | :-D When I was building Windows Forms app all the user had to do is press a button on the form to scan and after that to press a button to save the picture. Assuming that this web app will be used within a corporate network, the solution that insludes ActiveX component would be acceptable. But, could you post me some link where someone has done something similar? That would be very helpful.
SAKryukov 5-May-11 11:35am
I advise to use my recipe. This is very basic functionality, just a POST form with one file upload. There are millions of samples.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Monjurul Habib 4-May-11 15:25pm
nice advice.my5
NuttingCDEF 4-May-11 16:14pm
Agreed - my 5 too.

There might also be an alternative route using Flash - AFAIK Flash can be allowed (by the user) to access webcams - so might also be able to access a scanner similarly - but I'm definitely not a Flash guru so can't really help any further than that!
Wonde Tadesse 4-May-11 20:14pm
Good answer
SAKryukov 4-May-11 22:16pm
True, especially the warning against the solution. I once used the Web-based service which required scanned document and offered something like this. I denied to use the whole business -- no third-party code should be installed or run on my machine unless I explicitly do you myself.

I added the answer which says how it should work.
It's trivial but this is the only acceptable variant -- safe and non-intrusive.
E$w@r 5-May-11 11:35am
Yes true. I too agreed. My 5.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.

Pete O'Hanlon 5-May-11 2:01am
Spot on. I couldn't agree more.
SAKryukov 5-May-11 11:31am
Thank you, Pete.
SAKryukov 5-May-11 11:34am
@askaris, we have consensus here.
I suggest you formally accept this answer as well and follow this way.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 5 May 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100