Introduction
In this blog, we will learn how to generate a QR code using ASP.Net by simply entering Text, numbers, and a combination of both in the textbox and clicking on generate button. I found a very useful library for generating QR code which is IronBarcode. You can install it through the NuGet package. It supports .Net Core, Standard & Framework. It has cross-platform support.
To use this library we will create a demo project in a visual studio. I am creating ASP.Net Web Application using Web Form for that I am going to use the visual studio 2017 version. You can dowload code here and play with that.
Creating a New Project in Visual Studio
Open the Microsoft Visual Studio software and go to the File menu. Select "New Project", and then select "Web Application". In this article, we are going to use a web application to generate QR codes.

Select “Web” from the right panel then select ASP.NET Web Application (.NET Framework). Enter the project name. I am giving GenerateQRCode. You can give anything you wish to, and select the file path in the appropriate text box. I am choosing default. Then, click the “OK” button, as in the screenshot below.

Then select the “Empty” template and check the “Web Form” checkbox from “Add folders and core reference for” then click on the “OK” button as shown in the below screenshot.

The Microsoft Visual Studio project will now generate the structure for the selected application, and In this example, we are using ASP.Net Web Form So we can add a new item and then choose web from to write the code where you can enter the code and build and run the application. Next, we can add the library to test the code.
How to Install the Barcode Library through NuGet Package Manager
In Visual Studio Select Tools > NuGet Package Manager > Manage NuGet Packages for the solution.

Search for the specific package IronBarcode using the search box on the upper left. Select a package from the list to display its information, enabling the Install button and a version-selection drop-down. As shown below screenshot. The NuGet package will be installed for your project and reference will be added.
Advance barcode creation
We can add the annotation to the QR Code, set theme, set the font, display its value below it, add margins, change the barcode colour, and then save it, all quite simply in C#. We can also choose to export to HTML or PDF instead of an image if that is more appropriate for our application.


rudi naradaPosted May 25, 2023, 11:34 AM
Please input this number 01-2205-0367, the QR code is different ???
marcoPosted Sep 27, 2022, 2:00 PM
Hi, thanks for this tutorial. I have a problem with some strings like this: "S64083_37 / 22". The generated QRcode contains a question mark instead of a slash. The result is: "S64083_37? 22". Why should this happen?
pritam GiriPosted Jan 14, 2022, 10:24 AM
When i am going to run the project an error occured which is on clicking event of the button line number 3
Mohit SharmaPosted Jan 6, 2021, 3:33 PM
Please also provide QRCode.dll for framework 2.0
Mohit SharmaPosted Jan 6, 2021, 12:43 PM
Getting Below error..even after adding QRCode.dll in my local code..what else i need to add(using framework 2.0) Could not load file or assembly 'QRCoder' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Md Sohel RanaPosted Oct 19, 2020, 4:23 AM
How To Generate QR Code in Crystal Report Using ASP.NET.. Please any one help
Aktham MahmoudPosted Jul 21, 2020, 9:54 AM
Nice; I followed your coding, and save it in DB too, But I rebuild a page to show users data with QRcoder (for print etc) but I don't know what the way to reshow a data in placeholder inside DetailsView
Avinash TripathiPosted Jul 12, 2020, 1:48 AM
How can i use it for ASP.net C# in Visual Studio 2019 and want to generate my form data in QR...Can u please help me out with the code.... [email protected]
EthemPosted Mar 6, 2020, 12:18 AM
Hi, i need turkish language special chars to convert QR code. For Example: g s ? etc.
sijo thomasPosted Feb 27, 2020, 4:50 AM
Helloo.. the same code i was pasted in my .cs file and an error showing in 19th line. QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q); QRCodeGenerator.QRCode is not working...plz help me
lokeshPosted Jan 10, 2020, 1:01 AM
Utf-8 format text is not supporting
syed aliPosted Dec 16, 2019, 7:52 AM
String misbehave while reading QRCode, sometimes some special characters replace with another character. do u have any idea why string misbehave while reading with QRCode Scanner App ? please help i m frustrated with this.
The EndPosted Oct 15, 2019, 1:54 AM
Help me, i can't dowload, tks sir
Any XavPosted Oct 1, 2019, 10:08 AM
Many thanks, works excellently (vb.net).
Rohit yadavPosted May 13, 2019, 12:22 AM
From where we can take this 'QRCoder'.
Alin MathewPosted Dec 18, 2018, 11:26 PM
May i know how save this qr code in sql server
First LastPosted Nov 30, 2018, 12:29 PM
OK.. I took your QRCoder.dll from your Bin folder and added it to my Bin folder. I then added a reference to it in my References folder by browsing for it in my Bin folder. I used this code line from your demo code: QRCodeGenerator qrGenerator = new QRCodeGenerator(); as the 1 in the blog does not work. Now, the app now builds and works.
First LastPosted Nov 29, 2018, 2:51 PM
Part 2: Looking at your QRCoder using the Object Browser, I see there is a QRCodeGenerator.QRCode, but in mine there is NOT. Why?
First LastPosted Nov 29, 2018, 2:44 PM
Part 1: Here are the 2 lines from your demo file. The first 1 is not what is stated here in this blog. But it is no longer in error. The 2nd one still shows a red squiggly line and indicates that .QRCode does not exist. ----> QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);
sharad chougalePosted Nov 23, 2018, 4:29 AM
I have pass this string TU4146320181121182050814 bu QR is denerate different code.
sharad chougalePosted Nov 23, 2018, 4:27 AM
I have pass TU4146320181121182050814
sharad chougalePosted Nov 23, 2018, 3:58 AM
This DLL file is not working properly.
Bulent DemirtasPosted Nov 13, 2018, 1:30 AM
Error project
KOTRA RAGHAVENDRAPosted Oct 25, 2018, 4:06 AM
I DONE COPY AND PASTE IN VISUAL STUDIO2015,IM GETTING ERRORS
Vipin MittalPosted Aug 28, 2018, 7:03 AM
Please share dll for framework 3.5
yeswanth chintapalliPosted Jun 26, 2018, 7:11 AM
QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q); IN THIS LINE QRCODE SHOWING ERROR
yeswanth chintapalliPosted Jun 26, 2018, 7:11 AM
QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);