Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Comments
Sergey Alexandrovich Kryukov 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.
Sergey Alexandrovich Kryukov 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.
--SA

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.
 
Share this answer
 
Comments
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
Sergey Alexandrovich Kryukov 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.
--SA
TweakBird 5-May-11 11:35am    
Yes true. I too agreed. My 5.
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
 
Share this answer
 
v2
Comments
Pete O'Hanlon 5-May-11 2:01am    
Spot on. I couldn't agree more.
Sergey Alexandrovich Kryukov 5-May-11 11:31am    
Thank you, Pete.
--SA
Sergey Alexandrovich Kryukov 5-May-11 11:34am    
@askaris, we have consensus here.
I suggest you formally accept this answer as well and follow this way.
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900