KA.Barcode Generator for ASP.NET
How to Print Code 128 in ASP.NET with Valid Data
Complete ASP.NET source code to generate, print Code 128 images using Barcode Generator for ASP.NET
  • Easy Code 128 generation & printing in Microsoft Visual Studio and ASP.NET development environments
  • Provide detailed Java barcode tutorial, .NET barcode guide & C# barcode creation guides for users
  • Mature, flexible Linear Code 128 generating SDK software for ASP.NET applications
  • Generate Code 128 code set A, Code 128B, Code 128C to insert in ASP.NET website/web pages/ webforms
  • Simple to integrate Code 128 into MS Internet Information Service (IIS) through URL
  • Easy to create 1D Code 128 barcodes through control drag & drop in ASP.NET webform
  • Accurately encode all the ASCII characters into Code 128 bar codes
  • Complete user manual C# barcode guide, Excel barcode creation & VB.NET barcode integration provided
  • Efficient create, print scannable Code 128 with a variable length to insert in ASP.NET web pages
  • Compatible with Code 128 barcode specification ISO / IEC 15417 (2nd edition)
KA.Barcode for ASP.NET is a professional barcode device component library addin software to generate, create Code 128 and other 20+ linear & 2D barcode symbologies with best quality in ASP.NET websites, web service, Microsoft IIS, as well as C#, Visual Basic .NET class & console applications. Besides, user-friendly interface provides easy access to Code 128 image customization. Here are some methods for modifying Code 128 size and image :

Code 128 for ASP.NET Data Capacity:

  • Variable-length
Code 128 Data Encoding in KA.Barcode Generator for ASP.NET

Code 128 Data Encoding with C#, VB.NET Class in ASP.NET

  1. 1.
  2. 2.
    Add reference: Add "KeepAutomation.Barcode.Web.dll" to your ASP.NET project reference
  3. 3.
    Add to toolbox: To add BarcodeControl to your ASP.NET toolbox
Copy those following C# or VB.NET barcode procedure onto you project to print, produce Code 128 and save as string:
using KeepAutomation.Barcode.Bean;
BarCode barcode= new BarCode();
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128Auto;
barcode.CodeToEncode = "Code 128";
barcode.generateBarcodeToImageFile("C://barcode-code128-csharp.gif");
Dim barcode As KeepAutomation.Barcode.Bean.BarCode = New KeepAutomation.Barcode.Bean.BarCode

barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128Auto
barcode.CodeToEncode = "Code 128"
barcode.generateBarcodeToImageFile("C://barcode-code128-vbnet.gif")
Code 128 barcode generator provides 3 different Code Set: Code Set A, Code Set B, and Code Set C. Below are some more C#, VB.NET, ASP.NET mvc code to create Code 128 barcode as string.

Printing Code 128 with Code Set A

Code 128 Code Set A encodes characters with values from 00-95 according to ISO/IEC 646 and seven special characters.
  • Numeric numbers: 0-9
  • Upper case alphanumeric characters: A-Z
  • Punctuation characters
  • Control characters
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128A;
barcode.CodeToEncode = "CODE-128";
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128A
barcode.CodeToEncode = "CODE-128"

Generating Code 128 with Code Set B

Code 128 Code Set B encodes characters with values from 32-127 according to ISO/IEC 646 and seven special characters.
  • Numeric numbers: 0-9
  • Upper case alphanumeric characters: A-Z
  • Lower case alphanumeric characters: a-z
  • Punctuation characters
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128B;
barcode.CodeToEncode = "Code-128";
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128B
barcode.CodeToEncode = "Code-128"

Creating Code 128 with Code Set C

Code 128 Code Set A encodes the set of 100 digit pairs from 00 to 99 and three special characters.
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128C;
barcode.CodeToEncode = "0128";
barcode.Symbology= KeepAutomation.Barcode.Symbology.Code128C
barcode.CodeToEncode = "0128"
Code 128 Data Encoding with Drag & Drop BarcodeControl
  1. 1.
    In "Choose Toolbox Items" form, click button "Browse...", and select KeepAutomation.Barcode.Web.dll
  2. 2.
    Now you'll see BarCodeControl in your toolbox
  3. 3.
    Drag and drop the BarCodeControl into the Forms and a Codabar image is generated
  4. 4.
    Find barcode setting panel, choose "Symbology" to "Code128Auto", "Code128A", "Code128B" or "Code128C"
  5. 5.
    Then input all ASCII characters in "CodeToEncode" accordingly
  6. 6.
    A Code 128 or Code 128 Extension barcodes with different characters occurs
Code 128 Data Encoding in Internet Information Service (IIS)
  1. 1.
    Copy folder "barcode" in your download the trial package to your IIS web application folder
  2. 2.
    Create a virtual directory, named "barcode", and link to your just copied "barcode" folder
  3. 3.
    Restart IIS and now you have successfully installed the ASP.NET Barcode Generator web application
  4. 4.
    To test it, open your web browser, and navigate to "http://localhost/barcode/barcode.aspx?symbology=7&code-to-encode=0123456789"
  5. 5.
    A Code 128 barcode with numeric data will be displayed
Note: In IIS, Symbology.Code128Auto is 7; Symbology.Code128A is 8; Symbology.Code128B is 9; and Symbology.Code128 is 10. Users may write "symbology=x&code-to-encode=xxx" or "symbology=x&code-to-encode=xxx" accordingly to change encoded data.