How to read barcodes from webcam in web applications in ASP.NET and ASP

  • Home
  • /
  • Articles
  • /
  • How to read barcodes from webcam in web applications in ASP.NET and ASP

This tutorial shows how to make barcode reading from web camera in ASP.NET application with Barcode Reader SDKHTML5 (or flash) and Javascript

Here is the screenshot showing how the Google Chrome browser runs ASP.NET code reading Code 128 barcodes from webcam:

IMPORTANT: it is possible to use web cam from Internet Explorer 9+ (with flash enabled), Chrome, Firefox, Safari

To run the sample Visual Studio 2008/2010/2012 or higher is required.
  1. Install evaluation copy of BarCode Reader SDK (the latest version in required)
  2. in Visual Studio use File – Open – Web-Site.. and open the folder with this sample
  3. Add a reference to ByteScout BarCode Reader dll using the menu: Website – Add Reference (find Bytescout Barcode Reader SDK on .NET tab, select and click OK to add a reference)
  4. Right-click on “Default.aspx” file and select “Set As Start Page”
  5. Run the project in debug mode
  6. Visual Studio will run your project in Internet Explorer or another browser. When browser asks for permission to access web-cam click “Allow” to allow access to web cam 
  7. click “START BARCODE SCAN..” button so the page will start automatically to grab frames from video and sending it to server-side code to read barcodes using Barcode Reader SDK
  8. IMPORTANT: barcode should be in focus. Some webcams are not focusing on small barcodes, you may need to adjust the focus on your webcam so it will work OK with small images like barcodes
  9. Click Stop to stop barcode scanning
Select barcode type to scan (by default scans for all known types).
You can look at the code in ByteScout Blog. The full source code of this sample is included into the evaluation version of BarCode Reader SDK.
Another sample how to read barcode from web camera for desktop applications is here.