narasiman rao

narasiman rao

  • NA
  • 519
  • 768.4k

when i execute the below code it is not working in server

Oct 21 2013 8:55 AM
My code as follows

                Bitmap bitmap = new Bitmap(990, 540);
                Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
                graphics.CopyFromScreen(5, 160, 0, 0, bitmap.Size);
                bitmap.Save(@"c:\\" + ddlSession.Text.ToString().Trim() + "DailySchedule.bmp", ImageFormat.Bmp);
                ShowEditLink(true);
                lblUpdate.Text = "This image is saved";
             


   The above code is working in local machine, but when i execute on the server error as follows

   System.ComponentModel.Win32Exception: The handle is invalid
    The below error shows in following line as follows

   graphics.CopyFromScreen(5, 160, 0, 0, bitmap.Size);

 
  please help me. what is the problem in my code.

Regards,
Rao.

    

Answers (1)