Click here to Skip to main content
15,394,479 members
Articles / Web Development / HTML
Posted 29 May 2005


78 bookmarked

.NET Web Twain

Rate me:
Please Sign up or sign in to vote.
3.27/5 (27 votes)
29 May 20051 min read
Web twain.

Sample Image - Web_Twain.jpg


Simply I want to use scanner in client side in DMS (Document Management System) web application. I have searched the Internet for solution but I found it very expensive for me so I decided to write a free one.


I found some articles in CodeProject like .NET TWAIN image scanner By NETMaster. That's nice. That is my goal:

  1. Rewrite NETMaster's application to be in one Windows form, make it automated and find way to deploy it in web page.
  2. Call this application from your web page.
  3. Upload the acquired image to server in simple way.

step 1:nop

step 2:You can use JavaScript to do it.

<input onclick="'file:///C:/TZTwain/TZTwain.exe',1);"
           type=button value=Scan>

But this code will not work with Windows XP sp2 :( So use this one:

<input onclick=runApp() type=button value="Scan XP sp2 users" name=button1>
<script language="javascript" type=text/javascript>
function runApp() 
  var shell = new ActiveXObject("");"c:\\tztwain\\tztwain.exe", 1, true); 

Step 3: You can use FTP or simply web service like me.

Sample App

  1. Configure testScan and FileUploadWS in IIS.
  2. FileUploadWS: Change save location.
    string filePath=Server.MapPath(@"..\testscan\upload\j2.jpg");
  3. TestScan: gives write permission to users (ASP.NET, IWAM and IUSR) at upload folder.
  4. Change web reference in testdotnettwain to localhost. Then build it and ZIP the exe file with winrar and make it sfx (with these options).
    Overwrite=1) then put the tztwain.exe in c:\inetpub\wwwroot\testScan.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Taha Elsayed
United States United States
Senior Development Manager, with 11 years of experience. Focused on design/developing/delivery B/OSS modules to satisfy customer/business requirements in accordance to TM Forum's TAM/SID framework. Excellent communication and interpersonal skills, flexibility, ability to adjust to new people and situations, strong problem solving skills and willing to work effectively and efficiently. Gained additional leadership skills such as: - High effective mentorship and coaching - Clearly communication and solutions sharing with my team - Decision making

Comments and Discussions'file:///C:/TZTwain/TZTwain.exe',1); Pin
Member 129199276-Jan-17 21:42
MemberMember 129199276-Jan-17 21:42 
Questionhow to fallow the step Pin
Member 1181899010-Jan-16 22:10
MemberMember 1181899010-Jan-16 22:10 
GeneralIt's working fine Pin
mkrishnan605-Sep-13 2:17
Membermkrishnan605-Sep-13 2:17 
GeneralRe: It's working fine Pin
sandeep7589-Dec-14 6:09
Membersandeep7589-Dec-14 6:09 
Questionscan Pin
masumeh__7-Jan-12 5:32
Membermasumeh__7-Jan-12 5:32 application using Twain in c# Pin
akul12323-Aug-11 20:40
Memberakul12323-Aug-11 20:40 
GeneralMy vote of 1 Pin
AtenaShirzad21-Aug-11 0:47
MemberAtenaShirzad21-Aug-11 0:47 
GeneralRe: My vote of 1 Pin
Taha Elsayed7-Oct-16 4:37
MemberTaha Elsayed7-Oct-16 4:37 
GeneralThis useless article should be removed Pin
Member 7509855-Feb-11 20:57
MemberMember 7509855-Feb-11 20:57 
GeneralRe: This useless article should be removed Pin
Taha Elsayed7-Oct-16 4:38
MemberTaha Elsayed7-Oct-16 4:38 
Generalask for help Pin
Member 391195816-Jan-11 17:40
MemberMember 391195816-Jan-11 17:40 
GeneralI feel your pain.. Pin
bjames0218-Jul-10 21:21
Memberbjames0218-Jul-10 21:21 
GeneralMultiPage Scaning Pin
vikica10-Jun-09 4:01
Membervikica10-Jun-09 4:01 
GeneralRe: MultiPage Scaning Pin
vikica12-Jun-09 2:37
Membervikica12-Jun-09 2:37 
GeneralRe: MultiPage Scaning Pin
str_test3-Jul-10 6:53
Memberstr_test3-Jul-10 6:53 
GeneralRe: MultiPage Scaning Pin
Taha Elsayed3-Jul-10 10:36
MemberTaha Elsayed3-Jul-10 10:36 
Generalhelp Pin
Travis R9-Mar-09 9:39
MemberTravis R9-Mar-09 9:39 
Generalaccess denied error Pin
forgoats22-Nov-08 4:03
Memberforgoats22-Nov-08 4:03 
AnswerRe: access denied error Pin
Offroad_0112-Dec-08 1:00
MemberOffroad_0112-Dec-08 1:00 
GeneralRe: access denied problem Pin
4hmeT22-Aug-12 0:56
Member4hmeT22-Aug-12 0:56 
GeneralRe: access denied problem Pin
sandeep75810-Dec-14 15:31
Membersandeep75810-Dec-14 15:31 
GeneralRe: access denied error Pin
farrukhahmedqureshi14-May-10 0:55
Memberfarrukhahmedqureshi14-May-10 0:55 
Generalit's working !! Pin
Oracle500726-Oct-08 20:33
professionalOracle500726-Oct-08 20:33 
QuestionHey , Are You Sure This Work friend? Pin
Oracle500720-Oct-08 22:33
professionalOracle500720-Oct-08 22:33 
QuestionMicrosoft JScript runtime error: Automation server can't create object Pin
Fahim_6213-Jun-08 20:09
MemberFahim_6213-Jun-08 20:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.