组件下载地址:http://pan.baidu.com/s/1bpbtk
引用<img src="如下网址asp.net网页">
protected void Page_Load(object sender, EventArgs e)
{//Response.Write(CreateCode_Simple("abba"));
CreateCode_Simple("abba");
}
private void CreateCode_Simple(string nr)
{
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
qrCodeEncoder.QRCodeScale = 4;
qrCodeEncoder.QRCodeVersion = 8;
qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
//System.Drawing.Image image = qrCodeEncoder.Encode("4408810820 深圳-广州 小江");
System.Drawing.Image image = qrCodeEncoder.Encode(nr);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
Response.ClearContent();
Response.ContentType = "image/gif";
Response.BinaryWrite(ms.ToArray());
//graph.Dispose();
image.Dispose();
/*string filename = DateTime.Now.ToString("yyyymmddhhmmssfff").ToString() + ".jpg";
string filepath = Server.MapPath(@"~\Upload") + "\\" + filename;
System.IO.FileStream fs = new System.IO.FileStream(filepath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
fs.Close();
image.Dispose();*/
//二维码解码
//var codeDecoder = CodeDecoder(filepath);
}
原文引用自网络