Click here to Skip to main content
15,905,587 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to do a screen capture of the entire desktop screen in vb web form .aspx.
I could find the code for form on the internet.
But not for web form.

Is there any guide that i can use to perform a screen capture in vb web form .aspx?
Posted

You can't do this and it's no surprise why.

Well, at leat you cannot do this in your ASP.NET code. All of your ASP.NET code runs on the server-side only and generated the HTML that is sent to the browser. The server cannot see the screen of the client machines.

Another problem is that any code running in a users browser runs in a restricted sandbox and cannot get at the machine resources, such as its filesystem, desktop, registry, whatever. This is for security reasons.

Is there a way around this?? Yes. You'd have to write a ActiveX control that the user has to download and install that your web page can call to take the screenshot for you. The problem with this is that not every platform will run an ActiveX control. You'll be limited to Windows machines only. No, I don't have an example.


Now you know why you can't find any ASP.NET code to do this...
 
Share this answer
 
 
Share this answer
 
Comments
von1991 2-Feb-12 3:54am    
That is also not for web form
To create a screenshot in c# we need to use drawing api of the .net framework

First you have import System.Drawing.Imaging name space with following code...

C#
using System.Drawing.Imaging;


here is the code in C# for screenshot.

C#
 int screenWidth = Screen.GetBounds(new Point(0, 0)).Width;
int screenHeight = Screen.GetBounds(new Point(0, 0)).Height;
Bitmap bmpScreenShot = new Bitmap(screenWidth, screenHeight);
Graphics gfx = Graphics.FromImage((Image)bmpScreenShot);
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight));
bmpScreenShot.Save("test.jpg", ImageFormat.Jpeg);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900