generic GDI+ error

Feb 26 2006 2:29 PM
I have a page on my asp.net app that I want to use image verification.  I've created 4 images saved on the server named like imgVerify1.jpg, imgVerify2.jpg, etc.  When I run the code below, I get a generic GDI+ error on the b.Save line.  I can't figure out what's going on, but I'm not very experienced with the GDI+.  Anyone see something I'm missing?  Thanks.

Random r = new Random();

int val = r.Next(1,4);

try

{

System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath("images/imgVerify" + val.ToString() + ".jpg"));

System.Drawing.Bitmap b = new Bitmap(img, new Size(100, 50));

b.Save(Global.UploadDir + "imgVerify.jpg");

imgVerify.ImageUrl = "images/imgVerify.jpg";

lblVerify.Text = GetVerifyText(val);

}

catch(Exception exc){

lblError.Text = "An error occurred. Sorry for the inconvenience." + exc.ToString();

Response.End();

}