My previous article is Asp.Net Core 10: Access/Get RequestQuery String Value In Controller Using C#.Net.
You may like few of my previous articles:
Bind Webgrid (GridView) with Entity Framework, Asp.net Core MVC, C#, SQL, Download File From wwwroot Folder Asp.Net Core 10 Using C#, Render PartialView in Asp.Net Core MVC Using C#.Net, Mastering the for Loop in C# (.NET 10): Examples and Best Practices, ASP.NET Core MVC Custom Error Page Tutorial (C#.NET), jQuery DateTime Picker Calendar in Asp.Net Core MVC, Step‑by‑Step Guide: Import and Display Excel Data in ASP.NET Core MVC with C#.
using Microsoft.AspNetCore.Mvc;
using QRCoder.Core;
using System.Drawing;
namespace QRCodeGeneration.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
QRCodeGenerator qrGenerator = new QRCodeGenerator();
var qrCodeData = qrGenerator.CreateQrCode("codemantra99.com", QRCodeGenerator.ECCLevel.Q);
var qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(25);
string imageSavePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "qrcode.png");
qrCodeImage.Save(imageSavePath, System.Drawing.Imaging.ImageFormat.Png);
return View();
}
}
}
In above code I have generated the QA code and save it in wwwroot folder. Now let's create the view and add the below code. @{
ViewData["Title"] = "QR Code";
}
<div style="text-align:left;">
<img src="qrcode.png" style="width:200px;height:200px"/>
</div>
In above view code i have used an image tag to display the QR code. Here qrcode.png have been provided as an image path to display the QR image. Now lets run the code to check the output.

