Wednesday, April 13, 2011

Get a screenshot from an ASP.Net page

I have an ASP.Net page that has a button that when clicked I would like to take a screenshot of the user's PC and send it to a server.

I'm ok with writing some sort of listener program to run on the server to accept requests to receive these images. Where I'm a bit hazy is the best way to get the user's PC to send the screenshot. Would this need to be done by writing some sort of Active X control for the ASP.Net page? It needs to be cross browser and operating system if possible.

Just a point in the right direction and what technologies I should use would be great. I would rather write this functionality myself if possible than use an out of the box solution as I can see that this functionality may be extended in the future. How does something like WebEx or copilot manage this?

Thanks

Gavin

Edit : Just to make it clear I'm not trying to steal information from a users PC, They would have to allow this functionality, Its more from a support point of view so when a clients having issues they can send a screenshot of the page they are on.

From stackoverflow
  • If it needs to be cross-browser and all, you should take a look at Java(applets). It may sound old fashion but I think it's your best option. ActiveX works on windows/IE only ;)

    For starters, take a look at this question, which is quite similar: http://stackoverflow.com/questions/58305/java-is-there-a-way-to-take-a-screenshot-using-java-and-save-it-to-some-sort-of

    Gavin Draper : If I wrote it in Java, I guess I could still open a TCP connection to a c# program running on the server and send it the image that way?
    Greg Dean : Why not just post the binary pack to the server?
    Gavin Draper : Didnt know that was possible, but if it is, it sounds like the ideal solution.
  • ActiveX would work. I suspect you might be able to do something in Silverlight, Flash, or Java applet as well (which would be more cross-browser friendly).

    As for copilot, it is running in a stand alone executable that the each user downloads and runs. So it's not confined to typical browser limitations.

  • It is just the web page you want a snap shot of?

    Then you can access the entire pages rendered html from the javascript document object and send it to a web service along with browser type etc. No ActiveX install required :-)

  • I use WebsitesScreenshot component to capture website screenshot or thumbnail image. This .NET Component is very easy to use. I love this component. http://www.websitesscreenshot.com/

    Sample code:

    WebsitesScreenshot.WebsitesScreenshot _Obj; _Obj = new WebsitesScreenshot.WebsitesScreenshot(); WebsitesScreenshot.WebsitesScreenshot.Result _Result;
    _Result = _Obj.CaptureWebpage("http://www.msn.com"); if (_Result == WebsitesScreenshot. WebsitesScreenshot.Result.Captured) { _Obj.ImageWidth = 200; _Obj.ImageHeight = 300; _Obj.ImageFormat = WebsitesScreenshot. WebsitesScreenshot.ImageFormats.PNG; _Obj.SaveImage("c:\msn.png"); } _Obj.Dispose();

0 comments:

Post a Comment