QR Code Image Sample - pqScan.com
ASP.NET Code128 Creator Web Forms Control Encoding Code 128 Barcode Image in ASP.NET Web forms Online Demo Download Trial Purchase Now
.NET Winforms

How to Generate Code128 in ASP.NET Web Server?

back to home  >  .NET Barcode Generator SDK  >   Generate Barcodes in ASP.NET  >  Generate Code128 in ASP.NET

ASP.NET Code128 Creator is one of the barcode generation functions in pqScan Barcode Creator for ASP.NET. There are three ways to show you creating Code128 in ASP.NET applications. The first guides you to generate Code 128 using API methods in web pages, the other two guide you to render Code128 using ASP.NET Barcode Web Control.

There are some tutorials for other type of barcodes generated in web pages: Aztec Code in ASP.NET, QR Code in ASP.NET, EAN-13 in ASP.NET.

Making and creating Code128 use ASP.NET Barcode Creator API in web form class

In this example, we will give a guide to introduce you how to generate Code128 using C# in ASP.NET project.

using System;
using System.Web;
using System.Web.UI;
using PQScan.BarcodeCreator;

namespace Code128GeneratorInWeb
    public partial class WebForm1 : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            Barcode code128 = new Barcode();

            code128.Data = "123456789";
            code128.BarType = BarCodeType.Code128;
            code128.Width = 200;
            code128.Height = 100;
            code128.ShowText = true;


generate code128 in asp.net

Generating and drawing Code128 on web page or html page in IIS

  1. Publish your ASP.NET web site to IIS.
  2. Copy "PQScan.BarcodeCreator.dll" file from downloaded barcode generator package to your IIS bin folder.
  3. Copy "BarcodeWebHandler.ashx" file from downloaded barcode generator package to your IIS.
  4. Create an empty html, and add the image code <img src="http://localhost:port/BarcodeWebHandler.ashx?BarType=Code128&Data=123456789&Width=150&Height=100&ShowText=True"/> to the page.
  5. Open html page on web browser to view the Code128 barcode created on the page.

Note: Ensure the "BarcodeWebHandler.ashx" file is copied to the folder where the web pages you want to generate Code 128 barcodes, otherwise the Code128 image will not appear.

Creating Code128 and printing it on web pages using ASP.NET Barcode Creator Web Control in Visual Studio

Additional, we provide a much more easier way to draw Code 128 image on web pages by ASP.NET Barcode web control. Follow these steps:

  1. Unzip the downloaded Code128 barcode generator package, copy the "PQScan.BarcodeCreator.dll" to your web application's bin folder.
  2. Add ASP.NET Barcode Creator Web Control to Visual Studio Toolbox.
  3. Drag and drop BarcodeWebControl item to your ASPX web forms.
  4. Copy "BarcodeWebHandler.ashx" file to the file path where the web page would render Code128 images.
  5. Run the web application to view the Code128 image generated.
  6. To customize the Code128 image, you can customize barcode property settings in the right-side "properties" pane or in the run-time code. What's more, changing Code128 web image control's src property by java script in client side is also support.
.NET Barcode Creator QR Code Creator in ASP.NET Data Matrix Creator in ASP.NET PDF 417 Creator in ASP.NET Aztec Creator in ASP.NET EAN 13 Creator in ASP.NET EAN 8 Creator in ASP.NET UPC A Creator in ASP.NET Code 39 Creator in ASP.NET