引用
QRCoder
示例代码
<img src="/Controller/GetImg"/>
public ActionResult GetImg()
{
string authorizeUrl="";
string authorizeCode = Guid.NewGuid().ToString();
//生成二维码
string url = $"{authorizeUrl}?authorizeCode={authorizeCode}";
QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q);
QRCode qrcode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrcode.GetGraphic(5, Color.Black, Color.White, null, 15, 6, false);
MemoryStream ms = new MemoryStream();
qrCodeImage.Save(ms, ImageFormat.Jpeg);
return File(ms.ToArray(), "image/jpeg");
}
参考资料
angular-cli server - how to proxy API requests to another server? C# 生成二维码 QRCoder
|
请发表评论