Streaming Code 128 Image into Your ASP.NET Web Pages
- Under downloaded trial package, copy barcode folder and its contents to your IIS, and create a new virtual directory, named "barcode".
- Restart IIS, navigate to http://YourDomain:Port/barcode/linear.aspx?DATA=CODE128&TYPE=7.
- To create barcode image in html or aspx pages, you can insert a image tag (img) into your web pages.
For example, <img src="http://YourDomain:Port/barcode/linear.aspx?DATA=CODE128&TYPE=7"/>
Generate Code 128 into Your ASP.NET Web Forms
- Install ASP.NET Barcode Generator Control.
- Add ASP.NET Barcode Generator Control to your Visual Studio ToolBox.
- Copy "linear.aspx" and "linear.aspx.cs" to the folder where your aspx pages are generating barcodes.
- Drag and drop "LinearWebForm" to your ASPX web forms.
- Run the website to view the barcodes generated. To customize Code 128 settings, view Code 128 barcode settings.
Generate Code 128 Barcodes in ASP.NET Class
If you need generate Code 128 barcodes in your ASP.NET class using C# or VB.NET, we provides complete barcode generation source code forCode 128 in C# and Code 128 in VB.NET.
Code 128 Barcode Data Character Encoding in ASP.NET
This section defines the supported character sets and encoding rules for Code 128 in your ASP.NET project.
Code 128 supports the following character sets for ASP.NET barcode encoding:
Code 128 supports the following character sets for ASP.NET barcode encoding:
- All 128 full ASCII characters defined in ISO/IEC 646
- Extended ASCII characters (ISO/IEC 8859-1, Latin Alphabet 1, values 128–255) using the FNC4 function character
- 4 non-data function characters for specialized operations
- 4 code set selection characters for dynamic encoding
- 3 unique start characters to initialize barcode generation
- 1 mandatory stop character to terminate the barcode
Code 128 Data Code Sets in ASP.NET
Code 128 uses three dedicated code sets to optimize data density, configurable in your ASP.NET C# code.
Auto Mode (Recommended for ASP.NET)
Manual Mode
- Code Set A: Supports uppercase letters, numbers, and control characters
- Code Set B: Supports uppercase/lowercase letters and standard symbols
- Code Set C: Supports numeric-only data (double-density encoding)
Auto Mode (Recommended for ASP.NET)
- Set the Type property to BarcodeType.CODE128
- The library automatically selects the optimal code set for your data
Manual Mode
- BarcodeType.CODE128A: Force Code Set A
- BarcodeType.CODE128B: Force Code Set B
- BarcodeType.CODE128C: Force Code Set C
Code 128 Function Characters (FNC) in ASP.NET
Function Characters (FNC) are special non-data symbols that trigger device operations in barcode scanners integrated with ASP.NET applications.
Supported FNC characters:
Supported FNC characters:
- FNC1: Used for GS1 system integration (GS1-128 standard)
- FNC2: Enables barcode message append functionality
- FNC3: Triggers barcode reader initialization/reprogramming
- FNC4: Encodes extended ASCII characters (ISO/IEC 8859-1)
- No manual input of FNC characters is required in your ASP.NET code
- The barcode library automatically encodes function characters based on your data
- No additional configuration is needed for standard web app scenarios
Code 128 Check Digit Logic in ASP.NET
Code 128 includes a mandatory check digit (checksum) calculated using the Modulo 103 algorithm for data integrity in ASP.NET applications.
- The check digit is auto-generated and cannot be disabled
- It is not visible in the Human Readable Interpretation (HRI)
- Barcode decoders do not return the check digit as usable data
- The AddCheckSum property is not applicable to Code 128
Code 128 Human Readable Interpretation (HRI) in ASP.NET
Human Readable Interpretation (HRI) is the plain text displayed alongside the Code 128 barcode, rendered in your ASP.NET View / Razor Pages output.
To display HRI above the Code 128 symbol in ASP.NET, you must set a negative TextMargin value. Incorrect values will cause text overlapping or missing rendering.
To display HRI above the Code 128 symbol in ASP.NET, you must set a negative TextMargin value. Incorrect values will cause text overlapping or missing rendering.
Code 128 Dimension & Size Settings in ASP.NET
Customize barcode dimensions to fit your ASP.NET Layout, View Component, or Partial View design requirements.
Configurable Properties:
Note: Maintain a minimum quiet zone of 10X in your ASP.NET project. Insufficient margins will cause barcode scanning failures in production environments.
Configurable Properties:
- UOM (Unit of Measure): Supports PIXEL, CM, INCH for ASP.NET rendering
- X: Width of the narrowest barcode module (minimum defined by your application spec)
- Y: Total height of the barcode bars
- LeftMargin / RightMargin: Quiet zones (minimum width = 10X for scan compatibility)
Note: Maintain a minimum quiet zone of 10X in your ASP.NET project. Insufficient margins will cause barcode scanning failures in production environments.
Summary
This guide fully covers the details of generating Code 128 barcodes in ASP.NET and ASP.NET Core projects, from basic implementation to advanced configuration. You learned to integrate barcode generation into the ASP.NET request pipeline, configure character sets, manage HRI and dimensions, handle check digits, and implement GS1 encoding. By following the structured workflow, you can deploy reliable, standards-compliant Code 128 barcode functionality to your ASP.NET Web App, MVC, Razor Pages, or Web API.
