生成图片的URL假设是这样:http://localhost/administrator/qrcode.aspx?pid=78
qrcode.aspx.cs的生成图片的部分代码:
Image image = new Bitmap(200, 200); Graphics g = Graphics.FromImage(image);try{ string url="http://localhost"; DotNetBarcode bc = new DotNetBarcode(); bc.Type = DotNetBarcode.Types.QRCode; bc.PrintCheckDigitChar = true; bc.WriteBar(url, 0, 0, 210, 210, g); System.IO.MemoryStream ms = new System.IO.MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); Response.ClearContent(); Response.ContentType = "image/Png"; Response.BinaryWrite(ms.ToArray()); ms.Dispose(); }finally{ g.Dispose(); image.Dispose(); }
现在如果我要输入http://localhost/administrator/qrcode.aspx?pid=78&download=true
就下载图片到本地要怎么做?
Smart猫小萌
相关分类