Our Customers
Contact Us Email: support@barcodelib.com
Home > ASP.NET Barcode > Barcode Generation Guide > ASP.NET Barcode Generation Guide in C#
Download Barcode for ASP.NET Trial

How to Generate Barcode in ASP.NET using C#

Barcode for ASP.NET - How to Use C# Code to Create Barcode Images for ASP.NET Web Projects
  • Easy to install BarcodeLib.Barcode.ASP.NET.dll to your Visual Studio ASP.NET Web application
  • Easy to encode and generate linear & 2d barcodes using C# demo code
  • Use C# code to create and print barcode images on web pages or your IIS projects
  • Use C# code to customize your created barcode image properties
  • Use C# code to save barcode images in the memory or stream to a web page
  • Able to generate more than 20 common barcodes, like Codabar, Code 39, Code 128, EAN/UPC,
    Postal Barcode, QR-Code, Data Matrix, PDF-417 and so on
ASP.NET C# Barcode Generation Prerequisites
  • BarcodeLib.Barcode.ASP.NET.dll
  • Microsoft .NET Framework 2.0 (or later)
  • Visual Studio .NET 2005 or above
Create Barcode Image in ASP.NET Web Application in C#

Install

  1. Add Reference BarcodeLib.Barcode.ASP.NET.dll component to your asp.net website project reference.

Implement

Here is the Visual C#.NET sample code for you to generate QR Code barcode images in C# Class Library. Please to your Visual Studio ASP.NET web applications for a barcoding test.
     BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();
barcode.Type = BarcodeType.CODE128;
barcode.Data = "CODE128";

barcode.LeftMargin = 0;
barcode.RightMargin = 0;
barcode.TopMargin = 0;
barcode.BottomMargin = 0;

barcode.Resolution = 72;
barcode.Rotate =RotateOrientation.BottomFacingDown;

barcode.UOM = UnitOfMeasure.PIXEL;

// other barcode settings.

// save barcode image into your system
barcode.drawBarcode("c:/csharp-barcode.png");

// generate barcode & output to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();

// generate barcode to <strong>Graphics object<strong>
Graphics graphics = ...
barcode.drawBarcode(graphics);

// generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode();

// generate barcode and output to HttpResponse object
HttpResponse response = ...;
barcode.drawBarcode(response);

// generate barcode and output to Stream object
Stream stream = ...;
barcode.drawBarcode(stream);
Other Methods to Create Barcodes in C# ASP.NET

Stream Barcodes with Buildin ASP.NET Barcode Application

Developers can stream barcode images with Buildin ASP.NET Barcode Application. Using this method you can create barcodes with a single URL through Microsoft Internet Information Service (IIS). Generated barcode images can be saved for future use, and you just need to pass the url to img tag.
This method is the easiest way as you can create dynamic barcode images, and adjust barcode settings through the url. View How to Stream Barcodes with Building ASP.NET Barcode Application

Generate Barcodes with Web Controller

  1. To use this barcoding method, you need to add BarcodeLib.Barcode.ASP.NET.dll component to your ASP.NET project.
  2. Copy the .aspx and the .aspx.cs files you need to the website where you will be generating barcodes.
  3. Now please add the asp.net barcode control to VS toolbox.



  4. Simply drag the control to your website. For example, QRCodeASPNET.
  5. Debug and a QR Code bar code is generated on the ASP.NET web site!
ASP.NET Barcode Generator Library - Supported Barcodes
  • Generate Linear Barcode Images in ASP.NET
    ASP.NET Linear Barcodes:


  • Generate 2D Barcode Images in ASP.NET
    ASP.NET Matrix Barcodes:

Other Related .NET Barcode Generator SDKs