> Tech FAQ
> Scan barcode in asp.net web application using C#
Hi,there, I'm asked to make as asp.net project with simple functions. It can allow users to upload barcode images(bmp, jpg, png, gif or tiff file), after that, users can decode the barcodes out, and show the results to the html page. Can you give us some recommendation using C# code?
To make things simple, you only need add two web controls into the aspx page. One is FileUpload control, the other is Button.
You can use the FileUpload control to upload the barcode image files in the asp.net application. In addition, you can insert a Image web control to the aspx page, after the barcode image uploaded, make this web Image control to display the barcode image dynamically. Please note, if you want to show this barcode image instant by ajax technique, you need use the UpdatePanel provided by Microsoft. Just insert the web Image into the UpdatePanel, the Image control can refresh immediately while the upload barcode image changed.
Then while you clicking the button, you can define the customized click event in the aspx.cs. Such as reading and scanning barcode feature can be added in this server side event.
Here we post the main sample C# code in the asp.net web page. You can make your own web application just like this. Please add the "PQScan.BarcodeScanner.dll" to your project reference.
public partial class Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void btUpload_Click(object sender, EventArgs e)
string name = this.FileUpload1.FileName;
string path = Server.MapPath("UploadFiles") + "\\" + name;
Session["filepath"] = path;
protected void btRead_Click(object sender, EventArgs e)
string result = "";
string path = Session["filepath"].ToString();
BarcodeResult barResults = BarCodeScanner.Scan(path);
if (barResults != null)
result = "";
for (inti = 0; i<barResults.Length; i++)
result += barResults[i].BarType.ToString() + " -- " + barResults[i].Data + "\r\n";
this.TextBox1.Text = result;
Hope the C# code can be helpful.
---- pqScan Support Team
Can I Read Barcode in PDF document using C#?
Need help for reading barcode with unconventional position?
How to read barcode from Microsoft Office?
Can I read barcode image from report in C# .NET?
Can I read color barcode image in C# .NET?
Is it available for reading all of the barcode in a picture by one time?
How to scan barcode from webcam or other device?
Can I use your barcode reading SDK in Mono?
I can't scan barcode from my images with different DPI.
How to scan barcode in asp.net web application?
How to scan barcode in WPF project using C# language?
Can I run your .net barcode reader library in Windows7 or Windows8?
How to scan rotated barcode in .net project?
SUPPORT SYSTEM: MICROSOFT WINDOWS XP, WINDOWS VISTA, WINDOWS 7, WINDOWS 8, WINDOWS SERVER. SUPPORT PLATFORM: .NET FRAMEWORK, VISUAL BASIC, VISUAL C#, ASP.NET, JAVA, JDK, SWING, APPLET, JSP, SERVLET, J2SE, J2EE. SUPPORT BARCODE TYPE: QR CODE, DATA MATRIX, PDF417, AZTEC CODE, CODE 128, CODE 39, CODE 93, CODABAR, EAN 13, EAN 8, UPCA, UPCE, ITF14. SUPPORT IMAGE FORMAT: JPEG, JPG, PNG, GIF, TIFF, TIF, BITMAP, BMP. SUPPORT VIEWER: MOZILLA FIREFOX, INTERNET EXPLORER, GOOGLE CHROME, OPERA, SAFARI, ADOBE and ACROBAT PDF.
Copyright © pqScan 2010-2019. All Rights Reserved.