使用前请先引用:ThoughtWorks.QRCode.Codecusing ThoughtWorks.QRCode.Codec;
//content = "欢迎光临75271.com"; QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE; qrCodeEncoder.QRCodeVersion = 20; qrCodeEncoder.QRCodeScale = 3; Image image; image = qrCodeEncoder.Encode(content,System.Text.Encoding.UTF8); System.IO.MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); Response.ClearContent(); Response.ContentType = "image/Jpeg"; Response.BinaryWrite(ms.GetBuffer()); ms.Close(); ms = null; image.Dispose(); image = null;