473,414 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

CopyFromScrenn - The handle invalid error

Hi All,

I am using the below code to take print screen of my web page.

> using (Bitmap bitmap = new Bitmap(620, 850))
{

using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);
}
bitmap.Save(System.AppDomain.CurrentDomain.BaseDir ectory.ToString() + 1 + ".JPEG", ImageFormat.Jpeg);
}

It works fine in the developement machine,but once i deploy it in the Server
it gives below error

Error Message: The handle is invalid
Source: System.DrawingError
Stack Trace: at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)

at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)

at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)

at Secure_SearchReport.btnSearch_Click(Object sender, EventArgs e)

at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

at System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument)

at System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)


Its very urgent .Any suggestion please.......
Dec 3 '10 #1
0 1581

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Danny | last post by:
Does anybody have a nice method of forcing a user to enter a value into a form using asp? I think the best is to have a popup when they hit submit that will stay on the same page and then just...
4
by: Not Me | last post by:
Hi, What exactly does the above (subject) error mean? I'm getting it from an adp file when used by a few people at the same time (each user has the file in their own filespace though). Access...
3
by: Ed Robichaud | last post by:
I'm temporarily stumped on how to handle/suppress an error (2501) if a user cancels sending an email. I'm using DoCmd.SendObject to trigger an Outlook send window, which works OK, but if the msg...
1
by: Abby | last post by:
Hi ... when I run my program, it produces error. I would like to know how to handle this error message. I don't want to see it on screen. Any way to just ignore it? Please let me know. Thanks a...
4
by: Ersin Gençtürk | last post by:
Server : WEB System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: The View State is invalid for this page and might be...
2
by: James | last post by:
I'm a newbie to vb.net, and classes were something I never played with in "standard" vb, but... Basically,part of my program comprises of some tcp/ip stuff, and I used the following code to...
8
by: Lambda | last post by:
When I call the standard strncpy function, I provide it a negative argument, such as: strncpy(s, ct, -1) I compile the code with gcc, when I run, it says "Segmentation fault". Do you think...
1
by: Chetana | last post by:
Hi All, I have one asp.net application in which connection gets expired after some time on my server actually i m thinking on how the connection gets removed because after some time I m getting...
8
by: jwan142 | last post by:
GOOOOD DAY. Geeks This is my first post and I do not know whether my title makes sense to you. Here is the problem.. I have a Access database. There is a table contains two fields called...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.