Everyone who works on ASP.NET websites will eventually come accross this error. A generic error occurred in GDI+. This usually happens when trying to save a image file to disk. Something normal like handling photo uploads then saving them. In my case I was trying to lower the quality on 20,000 JPG images to about 75%. The problem I ran into was it wouldn't let me overwrite my image to the original location. There is a very easy solution to this.
You get an error message like this
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
In your code you likely loaded a file into a Bitmap Object, made some edits and then tried saving that image back to the original location. Unfortunatley Bitmap Objects Lock the file until they are Disposed.
ImageCodecInfo codecs = ImageCodecInfo.GetImageEncoders();
ImageCodecInfo ici = null;
foreach( ImageCodecInfo codec in codecs )
if(codec.MimeType == "image/jpeg")
ici = codec;
EncoderParameters ep = new EncoderParameters();
ep.Param0 = new EncoderParameter (System.Drawing.Imaging.Encoder.Quality, 75L);
Bitmap largeBit = new Bitmap(file);
Bitmap goodBit = new Bitmap(largeBit);
largeBit.Dispose();
goodBit.Save(file, ici, ep);
goodBit.Dispose();
Hopefully this helps others.