【问题标题】:Display a generated qr code bitmap on webpage在网页上显示生成的二维码位图
【发布时间】:2015-08-13 10:15:03
【问题描述】:

我正在创建一个 asp.net (c#) Web 应用程序,并具有以下引用 https://github.com/codebude/QRCoder 的代码。我希望使用来自 url 的 ID 在页面加载时在网页上显示生成的 QR 码。

但是他们的示例仅显示了如何在带有图片框的 Windows 窗体应用程序中执行此操作,而不能在 Web 应用程序中使用。

    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.Params["ID"];
        QRCoder.QRCodeGenerator qrGenerator = new QRCoder.QRCodeGenerator();
        QRCoder.QRCodeGenerator.QRCode qrCode = qrGenerator.CreateQrCode("http://mywebsite.com/profile.aspx?ID="+ id+ "", QRCoder.QRCodeGenerator.ECCLevel.M);

        // pictureBoxQRCode.BackgroundImage = qrCode.GetGraphic(20);    //Can't use picture box in web app
        // I need to find the equivalent for a web app

    }

提前感谢您的帮助。

【问题讨论】:

标签: c# asp.net image image-processing bitmap


【解决方案1】:

我已经很久没有做网络表单的东西了。 但是由于没有其他人回答:

你为什么不使用像 http://davidshimjs.github.io/qrcodejs/ 这样的 javascript 库在客户端生成 qrcode 具有将计算从服务器卸载到客户端的额外优势。

【讨论】:

  • 这是一个网络表单应用程序,所以我在“public ActionResult qrCode (string id)”和文件内容结果中遇到错误
猜你喜欢
  • 1970-01-01
  • 2020-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多