目前我正在开发ASP.NET项目,需要使用嵌入式链接生成QR代码。我收到此错误: -
A generic error occurred in GDI+.
我使用过的代码: -
Bitmap img = encoder.Encode("http://localhost)/GFile/%20" + lblId.Text);
img.Save("~/QRimage/" + txtFName.Text + ".jpg", ImageFormat.Jpeg);
QRImage.ImageUrl = txtFName.Text + ".jpg";
堆栈追踪: -
[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder,
EncoderParameters encoderParams) +461268
System.Drawing.Image.Save(String filename, ImageFormat format) +69
ViewResume.btnQRcode_Click(Object sender, EventArgs e) in
c:\Users\Samba\Desktop\Den\ViewResume.aspx.cs:341
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.
RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String
eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +5563
答案 0 :(得分:1)
你的括号错了 改变这个:
Bitmap img = encoder.Encode("http://localhost)/GFile/%20" + lblId.Text
);
到此:
Bitmap img = encoder.Encode("http://localhost/GFile/%20" + lblId.Text);