-2

First am replacing ImagePath_DevSvr= D:\Image.jpeg ImagePath_DevSvr_tif=E:\images\1.tif

       System.Drawing.Bitmap wiImage1 = null;

   string ReplaceImage_path1 = System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr_tif"];

     wiImage1 = new System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_DevSvr"]);

      wiImage1.Save(ReplaceImage_path1);

Second am replacing ImagePath_TestSvr= D:\Image.jpeg ImagePath_TestSvr_tif=F:\images\1.tif

        System.Drawing.Bitmap wiImage = null;

       string ReplaceImage_path = System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr_tif"];

      wiImage = new   System.Drawing.Bitmap(System.Configuration.ConfigurationManager.AppSettings["ImagePath_TestSvr"]);

       wiImage.Save(ReplaceImage_path);

For first time replacing it is working for second it is not working please help me out Thanks in advance

2 Answers2

0

Use Image.FromFile instead.

Bitmap wiImage = (Bitmap) Image.FromFile(System.Configuration.ConfigurationManager.AppSettings["ImagePath"]);
Hamed
  • 1,175
  • 3
  • 20
  • 46
0

Reasons why it now works

  • Images\Image.jpg did not exist and then you created/saved it
  • You never saved the app.config file that had the app settings
Richard Schneider
  • 34,944
  • 9
  • 57
  • 73