Streaming Code 39 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=CODE39&TYPE=4.
- 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=CODE39&TYPE=4" />
Generate Code 39 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 39 settings, view Code 39 barcode settings.
Generate Code 39 Barcodes in ASP.NET Class
If you need generate Code 39 barcodes in your ASP.NET class using C# or VB.NET, we provide complete barcode generation source code for Code 39 in C# and Code 39 in VB.NET.
Code 39 Data Character Encoding in ASP.NET
Code 39 Standard Mode
Standard Code 39 supports 43 fixed characters for general use.
Set Type = BarcodeType.CODE39 to enable this mode.
Supported characters:
Set Type = BarcodeType.CODE39 to enable this mode.
Supported characters:
- Numeric digits: 0 - 9
- Uppercase letters: A - Z
- Special characters: -, $, %, (Space), ., /, +
- Automatic Start/Stop characters (*)
Code 39 Full ASCII Mode (CODE39EX)
Code 39 Full ASCII (Extended) supports the complete 128-character ASCII set (ISO 646 IRV).
Set Type = BarcodeType.CODE39EX to enable lowercase letters and special symbols.
Note: Always use CODE39EX for lowercase text in ASP.NET applications. Standard mode will fail to encode lowercase characters.
Set Type = BarcodeType.CODE39EX to enable lowercase letters and special symbols.
Note: Always use CODE39EX for lowercase text in ASP.NET applications. Standard mode will fail to encode lowercase characters.
Code 39 Check Digit & Text Settings in ASP.NET
Code 39 Check Digit (MOD43)
Code 39 does not include a check digit by default.
For enhanced data security, enable MOD43 checksum using AddCheckSum = true.
For enhanced data security, enable MOD43 checksum using AddCheckSum = true.
Hide Check Digit in HRI (Human Readable Interpretation)
You can enable the check digit but hide it from the displayed text.
Set ShowCheckSumChar = false.
Set ShowCheckSumChar = false.
Show / Hide Start/Stop Characters (*)
Code 39 uses * as Start and Stop symbols.
Control visibility with ShowStartStopInText.
Control visibility with ShowStartStopInText.
Code 39 Dimension & Size Settings in ASP.NET
Customize barcode size for your ASP.NET View, Partial View, or printing requirements.
All properties are configured in the Request Pipeline before image generation.
Note: The minimum quiet zone is 10X. Smaller margins will cause scanning failures in production environments.
All properties are configured in the Request Pipeline before image generation.
- UOM: Unit of measure (PIXEL, CM, INCH)
- X: Width of the narrow bar module
- Y: Height of the barcode module
- N: Wide-to-narrow bar ratio (2.0 - 3.0)
- I: Intercharacter gap width (multiple of X)
- LeftMargin / RightMargin: Quiet zone (minimum 10X)
Note: The minimum quiet zone is 10X. Smaller margins will cause scanning failures in production environments.
Advanced Code 39 Customization in ASP.NET
Wide Bar vs Narrow Bar Ratio (Property N)
The N property defines the width ratio between wide and narrow bars.
Valid range: 2.0 to 3.0 (default = 2).
Valid range: 2.0 to 3.0 (default = 2).
Intercharacter Gap (Property I)
The I property sets the space between barcode characters.
It is a multiple of the narrow module width X (default = 1.0f).
It is a multiple of the narrow module width X (default = 1.0f).
Summary
You have learned the complete process to generate and customize Code 39 barcodes in ASP.NET projects using C#.
Key content covered:
Key content covered:
- Two encoding modes: Standard (uppercase only) and Full ASCII (all characters)
- Check digit (MOD43) and text display settings improve security and usability
- Full control over dimensions, margins, and module sizes for web and print
- Advanced ratio and spacing adjustments ensure high scanning compatibility
- Fully supports ASP.NET Core, MVC, Razor Pages, Web API, and IIS/Kestrel hosting
