C# 二维码在线生成

    void CreateUrlQRCodeIMG()
    {
        Response.Cache.SetCacheability(HttpCacheability.Public);
        Response.Cache.SetMaxAge(TimeSpan.FromSeconds(600000));

        Response.ContentType = "image/gif";

        string link = Request.QueryString["url"] ?? string.Empty;
        if (string.IsNullOrEmpty(link))
        {
            return;
        }
        link = HttpUtility.UrlDecode(link);

        QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H);
        QrCode qrCode = qrEncoder.Encode(link);
        GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(8, QuietZoneModules.Four), Brushes.Black, Brushes.White);
        renderer.WriteToStream(qrCode.Matrix, ImageFormat.Gif, Response.OutputStream);

    }

 

上一篇:AChartEngine实现Android实时时间变化曲线


下一篇:Three.js 学习笔记之一 Helloworld(翻译)