---
title: "How to capture screenshot in asp.net"  
description: "How to capture screenshot in asp.net"  
author: "Vani V"  
published: 2010-12-13  
updated: 2010-12-14  
canonical: https://www.mindstick.com/forum/125/how-to-capture-screenshot-in-asp-dot-net  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to capture screenshot in asp.net

Hi All,

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to take a [Screen](https://www.mindstick.com/forum/33644/loading-screen-during-ajax-call) shot of the [client](https://www.mindstick.com/articles/23198/3-steps-to-ensure-that-your-client-portal-is-impeccable) Screen[they are allowed to draw a diagram,when they click save ,it should get saved as Image in database.

Also the user should be able to see it again] . After searching for 2 week ,i implemented the below code in [[windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) xp,[asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder),C#,SQL]

develpment machine and it [works fine](https://answers.mindstick.com/qa/115732/my-software-works-fine-on-windows-10-but-crashes-on-windows-11-why). When i deployed the app in [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) ,then the [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) started.When the Save [button is clicked](https://www.mindstick.com/forum/157821/write-a-jquery-code-that-selects-all-the-checkboxes-in-a-form-when-a-select-all-button-is-clicked) it gave

System.ComponentModel.Win32Exception: The handle is invalid\
[Win32Exception (0x80004005): The handle is invalid]

```
System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) +542 Default3.ThreadMethod() +225
```

\

| ## Below is the code |
| --- |

```
Rectangle bounds = new Rectangle(620, 370, Convert.ToInt32(Panel1.Width.Value) - 20, Convert.ToInt32(Panel1.Height.Value) - 10);   using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))   {     using (Graphics g = Graphics.FromImage(bitmap))     {       g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);     }     bitmap.Save(Server.MapPath("~") + "\\ScreenShot\\" + Request.QueryString["TrafficID"].ToString() + ".JPEG", ImageFormat.Jpeg);   } Thanks,
```

## Replies

### Reply by Uttam Misra

Hey Why you want to implement it client side? and If you are going to take screenshot then how you going to save in the database? We can implement it easily by using windows service but I am not sure about client side..\
and also you will not have any idea about client operating system ...so might be difficult ...\
see if you can find something in sliverlight...\
Good Luck!! ![How to capture screenshot in asp.net](https://www.mindstick.com/app_images/htmleditor.icons/msp_thumbup.gif)\


---

Original Source: https://www.mindstick.com/forum/125/how-to-capture-screenshot-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
