KA Barcode Reader for C# Library
How to read barcodes in C# ASP.NET framework, MVC, web apps?
Using barcode reader library to scan, read 1D and 2D Barcode Images in C# for ASP.NET Framework 4.x web Application
- Easy to scan, read 20+ linear and 2d barcode from images using C# in ASP.NET Framework 4.x, 3.x, 2.x, Razor pages, MVC, Blazor, ASP.NET web service, web applications
- Support reading barcode images from camera, database, network in ASP.NET web apps
- Quick to read, parse barcode with GS1 data message, Unicode text, byte array data in ASP.NET websites and applications
- Advancing barcode read, scan options, such as image regions scanning, rotated barcodes, multiple/bulk barcodes reading, imperfect image scanning
How to read barcodes using C# in a ASP.NET framework web application?
ASP.NET offers three frameworks for creating web applications: Web Forms, ASP.NET MVC, and ASP.NET Web Pages.
All three frameworks are stable and mature, and here we will create a new ASP.NET Web Forms application as an example.
The guide in this page will show you how to create a new ASP.NET framework (4.x) web application, integrate barcode image scanning and reading functions
in the online web browser using C# coding.
- Create a new ASP.NET framework (4.x) web application
- Install C# barcode reader library
- Add C# code to support online barcode reader function in web browser
- Run the web application from IIS
Creating ASP.NET Razor Site in Visual Studio
To create an ASP.NET Razor website in Visual Studio:
- Open Visual Studio 2022
- In "Create a new project" window, select ASP.NET Web Application (.NET Framework) as project template
- Key in project name as KeepAutomation.BarcodeReader.ASPNETFrameworkWebAppDemo. Click Create.
- In the "Create a new ASP.NET Web Application" window, choose Web Forms. Click Create.
Your new ASP.NET project exists and we will add C# barcode reader library dll to it and
add C# source code to integrate barcode reading function in ASP.NET Web app.
Add C# barcode reader library dll to ASP.NET web app
Here we will add KeepAutomation C# barcode reader dll library to the new ASP.NET web application.
- In "Solution Explorer", right click "References", and choose menu "Add Reference..."
- Click button "Browse...", and select file KeepAutomation.BarcodeReader.dll from downloaded package Dll/net40/
- Click button "OK". Now you can find the barcode reader library has been added to the ASP.NET web application.
Add C# source code to read barcodes in the ASP.NET web app
It is easy to read barcodes in the ASP.NET framework web application.
- Call method BarcodeReader.readBarcodeMessage() with barcode image file path and target barcode types.
The method will return all target barcodes data from the barcode image file.
String inputImageFile = @"D:\sample.png";
// Read QRCode from an image file.
String[] msgs = BarcodeReader.readBarcodeMessage(inputImageFile, BarcodeType.QRCode);