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.FromIm age(bitmap))
{
g.CopyFromScree n(new Point(bounds.Le ft, bounds.Top), Point.Empty, bounds.Size);
}
bitmap.Save(Sys tem.AppDomain.C urrentDomain.Ba seDirectory.ToS tring() + 1 + ".JPEG", ImageFormat.Jpe g);
}
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.DrawingE rror
Stack Trace: at System.Drawing. Graphics.CopyFr omScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize , CopyPixelOperat ion copyPixelOperat ion)
at System.Drawing. Graphics.CopyFr omScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize )
at System.Drawing. Graphics.CopyFr omScreen(Point upperLeftSource , Point upperLeftDestin ation, Size blockRegionSize )
at Secure_SearchRe port.btnSearch_ Click(Object sender, EventArgs e)
at System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
at System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument)
at System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument)
Its very urgent .Any suggestion please.......
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.FromIm age(bitmap))
{
g.CopyFromScree n(new Point(bounds.Le ft, bounds.Top), Point.Empty, bounds.Size);
}
bitmap.Save(Sys tem.AppDomain.C urrentDomain.Ba seDirectory.ToS tring() + 1 + ".JPEG", ImageFormat.Jpe g);
}
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.DrawingE rror
Stack Trace: at System.Drawing. Graphics.CopyFr omScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize , CopyPixelOperat ion copyPixelOperat ion)
at System.Drawing. Graphics.CopyFr omScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize )
at System.Drawing. Graphics.CopyFr omScreen(Point upperLeftSource , Point upperLeftDestin ation, Size blockRegionSize )
at Secure_SearchRe port.btnSearch_ Click(Object sender, EventArgs e)
at System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
at System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument)
at System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument)
at System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument)
Its very urgent .Any suggestion please.......