Search code examples
c#screenshot

Can I call Greenshot on a client's machine from a website?


I am looking to make Greenshot take an IE screen shot from the code behind of a C# Web Form. How can I call Greenshot from my server or code running in the browser and have it take a screenshot on the client's machine?


Solution

  • The code behind of a web form (or really, any code behind in ASP) is run on the server. The server cannot directly run code on a client (it can, of course, inject javascript into its responses).

    So no, you won't be able to do this in the manner you describe. However, if a given page had JS that performed this task for you on page load (or on a button click, or whatever), you could likely get a similar result.

    Looking at Greenshot it looks like that is a program that is run on the client's computer, so this is even more impossible as the browser sandbox isn't going to let JavaScript run that application. There are possibly other ways to get an image of the rendered content in JavaScript, but that approach seems very unlikely to work.