这个写了,但是自己没有用,发现浏览器有的不兼容
代码:
string str = System.Configuration.ConfigurationManager.AppSettings["MobileDomain"] + "/lmsViews/wechat/index.html#/main/signIn?TrainingID=" + TrainingID; //初始化二维码生成工具 QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE; qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M; qrCodeEncoder.QRCodeVersion = 0; qrCodeEncoder.QRCodeScale = 4; //将字符串生成二维码图片 Bitmap image = qrCodeEncoder.Encode(str, Encoding.Default); //保存为PNG到内存流 MemoryStream ms = new MemoryStream(); image.Save(ms, ImageFormat.Png); string strUrl = "data:image/png;base64," + Convert.ToBase64String(ms.ToArray()); image.Dispose(); ms.Dispose();
上面用的是微信中的一个dll
js进行调用
http://www.cnblogs.com/cdemo/p/5225848.html
http://blog.csdn.net/yiqijinbu/article/details/23673727