Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 15, 2011 06:12 AM by savindra.bandi
Nov 13, 2009 06:59 AM|LINK
thanks man that worked
thanks man that worked
Of course that worked! Thanks for advice :)
Feb 25, 2010 05:56 AM|LINK
@dacraka Completly Agree with you,one need to dispose the objects insted of carry them further... have a look a
private void SaveAsThumbNail(int thumb_height, int thumb_width, FileUpload FileUpldCntrl, string imgPath)
myimage = System.Drawing.Image.FromFile(Server.MapPath(imgPath));
System.Drawing.Bitmap source_bitmap = new System.Drawing.Bitmap(myimage);
System.Drawing.Bitmap thumb_bitmap = new System.Drawing.Bitmap(thumb_width, thumb_height);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(thumb_bitmap);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(System.Drawing.Brushes.White, 0, 0, thumb_width, thumb_height);
g.DrawImage(source_bitmap, 0, 0, thumb_width, thumb_height);
System.Drawing.Imaging.ImageCodecInfo Info = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();
System.Drawing.Imaging.EncoderParameters Params = new System.Drawing.Imaging.EncoderParameters(1);
Params.Param = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
thumb_bitmap.Save(Server.MapPath(imgPath), Info, Params);
catch (Exception ex)
CommonFunctions objcom = new CommonFunctions();
ex.Message.ToString(), HttpContext.Current, ex);
May 22, 2010 06:40 PM|LINK
This is only for read and write permision. Just enable write permision on your folder.
hopeful it will solve your problem.
Jul 08, 2010 10:09 AM|LINK
as me was blocked on the same issue from last 3-4 days n tried a lot of different attempts for the same but not a single one turned out to be successful.
But finally today i got the solution.
After making it double sure that all the permissions are set to WRITE.
USE string filepath = Server.MapPath("./Images/");
string filepath = Server.MapPath("~//Images//");
the main issue was while mapping a virtual path
it starts the path from site folder
so we need to map with "." instead of "~"
I have tried the same solution on 3 different projects for the same problem.
all of them started working very smoothly.
All the best..... :)
Sep 15, 2011 06:12 AM|LINK
If you are getting that error , then I can say that your application doesn't have a write permission on some directory [where your trying to save or write image].
For example, if you are trying to save the Image from the memory stream to the file system , you may get that error.
I also faced that error when I was using Infragistics charts control , the control was trying to create a temporary chart in ChartImages folder and my application was not given the write permission.
Please if you are using XP, make sure to add write permission for the aspnet account on that folder.
If you are using windows server (2003,2008) or Vista, make sure that add write permission for the Network service account.
Hope it help some one.
gdi+ memory bitmap sclaing drawimage resizing