问题描述
我的代码如下,项目中image文件夹也已经建好了,但是一点击生成二维码就提示“GDI+中发生一般性错误。”请大神指点下,我是小白protectedvoidbtnAdd_Click(objectsender,EventArgse){create_two(this.txtpwd1.Text);}privatevoidcreate_two(stringnr){Bitmapbt;stringenCodeString=nr;QRCodeEncoderqrCodeEncoder=newQRCodeEncoder();bt=qrCodeEncoder.Encode(enCodeString,Encoding.UTF8);stringfilename=string.Format(DateTime.Now.ToString(),"yyyymmddhhmmss")+".jpg";filename=filename.Replace("","");filename=filename.Replace(":","");filename=filename.Replace("-","");filename=filename.Replace(".","");bt.Save(Server.MapPath("~/image/")+filename+".jpg");this.Image1.ImageUrl="~/image/"+filename+".jpg";}
时间: 2024-11-12 22:41:51