How to Create a Fingerprint Scanner Software using C#

fingerprint scanner c#

Last Updated on 2021-09-14

Fingerprint authentication has been widely used for attendance and workforce management for its accuracy and ease of use. In more recent years, it has become a mechanism for identity management.

To create a fingerprint scanner system, the first job would be to capture images of fingers from fingerprint scanners. However, many APIs  do not support all fingerprint devices. Different fingerprint scanners usually come with their own SDK which lack flexibility and limit the usage of your application. Also, the SDK coming with the device usually doesn’t provide an API for you to upload the scanned images to your server or database directly.

With Dynamic .NET TWAIN SDK, you can easily create a fingerprint scanning software with C# that works with all fingerprint scanners with a TWAIN driver.

Access TWAIN Compatible Fingerprint Readers

TWAIN is a protocol for communication between software applications and imaging devices like scanners, cameras etc. Dynamic .NET TWAIN is a C# wrapper of TWAIN API. With it, you can easily capture images from TWAIN fingerprint devices and upload the images to your server, database or local disk in your C# or VB.NET application.

Here you can find a list of TWAIN-compatible fingerprint scanners (not an exhaustive list).

If you already acquired the fingerprint devices, you can test it with the online demo of Dynamic Web TWAIN to verify if it is TWAIN complaint.

free online document scan

Below we show the code snippets to achieve fingerprint image capture and uploading to SQL server database.

Scan Fingerprint Images

Dynamic .NET TWAIN provides easy APIs for you to access TWAIN fingerprint scanners. You can capture image with just a few lines of code.

private void AcquireImage()
try {
dynamicDotNetTwain1.IfDisableSourceAfterAcquire = true;

catch (Exception exp)

Upload Fingerprint Images to Server and SQL Server Database

Dynamic .NET TWAIN provides HTTP POST methods which enables you to upload captured images to server or database as JPG, PNG, BMP, single-page or multi-page TIFF or PDF files. Here you can see the code of how to upload images to SQL Server.

Upload button code — send image data to server side

private void btnUpload_Click(object sender, EventArgs e)
try {
dynamicDotNetTwain1.SetHTTPFormField("ExtraTxt", this.txtboxExtraTxt.Text); // pass extra text parameters when uploading image
dynamicDotNetTwain1.HTTPUploadThroughPost("localhost", 1, "SaveToDB.aspx", "test.jpg");
catch (Exception exp)

SaveToDB.aspx – receive and save the images to SQL Server

<%@ Page Language="C#"%>

string strImageName = "";
string DW_SaveTable = "tblWebTwain4";
string DW_ConnString = "Server=localhost\\sqlexpress;Database=DemoWebTwain;User ID=sa;Password=DefeGedetf;Trusted_Connection=False";
//string DW_ConnString = "Server=localhost;Database=DemoWebTwain;Integrated Security=SSPI";

int iFileLength;
HttpFileCollection files = HttpContext.Current.Request.Files;
HttpPostedFile uploadfile = files["RemoteFile"];
if (uploadfile != null)
strImageName = uploadfile.FileName;
iFileLength = uploadfile.ContentLength;

Byte[] inputBuffer = new Byte[iFileLength];
System.IO.Stream inputStream;

inputStream = uploadfile.InputStream;
inputStream.Read(inputBuffer, 0, iFileLength);

String strConnString;

strConnString = DW_ConnString;

System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(strConnString);

String SqlCmdText = "INSERT INTO " + DW_SaveTable + " (strImageName,imgImageData) VALUES (@ImageName,@Image)";
System.Data.SqlClient.SqlCommand sqlCmdObj = new System.Data.SqlClient.SqlCommand(SqlCmdText, sqlConnection);

sqlCmdObj.Parameters.Add("@Image", System.Data.SqlDbType.Binary, iFileLength).Value = inputBuffer;
sqlCmdObj.Parameters.Add("@ImageName", System.Data.SqlDbType.VarChar, 255).Value = strImageName;


catch (Exception exp)

You can download and try the demo applications of Dynamic .NET TWAIN in the code gallery.

To embed fingerprint scanning to your .NET desktop application, you can download a 30-day free trial of Dynamic .NET TWAIN.

Start your Free 30-Day Trial

If you need fingerprint reading in your Web application, Dynamic Web TWAIN, which is a TWAIN JS library, would satisfy your needs.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe Newsletter

Subscribe to our mailing list to get the monthly update.