TX Barcode .NET can be used in ASP.NET web applications to render barcode images. This sample shows how to use a WebForms Image control to render a barcode image that is created code-behind.

Rendering barcode objects in ASP.NET

The ASPX page is very simple and consists of a WebForms Image control, a label to show the raw text and a refresh button:


In the Page_Load event, the current date and time measured in ticks is passed as a QueryString to the ImageUrl property of the Image control. The URL is another ASPX page that uses TX Barcode .NET to create the barcode image.


In the Page_Load event of CreateBarcode.aspx, TX Barcode .NET is used to save the encoded string as a barcode image into a MemoryStream. This stream is returned using Response.BinaryWrite.


The HTML image element loads the image data dynamically from the CreateBarcode.aspx page. Every time, the Refresh button is clicked, the barcode is updated with the current date and time.

Download the sample from GitHub and test it on your own.