Like the title says, is it possible to run a winforms component inside a asp.net website and then take a screenshot of it?
Asked
Active
Viewed 728 times
2 Answers
1
It is possible to place a user control on a web page but my experience with it in the past were really bad.
I tried this back in 2005 and it worked on Internet Explorer only, and even in a well-defined intranet there were machines where it failed.
So I would vote against.
For the screenshot part, please see this SO posting.
-
Actually I was just looking for a solution to run the control in code and then capture a screenshot of it and show it to the user (the later part is easy once I got the screenshot in memory). – Andreas Jan 04 '11 at 16:35
-
So you are using the control only to take the screenshot of the website? Maybe it would be better to make a standalone Windows Forms application, use the `WebBrowser` control and then take a screenshot from the web browser? – Uwe Keim Jan 04 '11 at 16:43
-
I was thinking of using either Webkit.NET or GeckoFX to do that, yes. Both are webform-components so the solution would be to init the control in asp.net and then take a screenshot of it. And yes, I'm starting to think that I have to make a .net application and run it inside asp.net and take a screenshot of that. Would be more simple though to only use the component. – Andreas Jan 04 '11 at 16:47
-
For which purpose do you need the screenshots? – Uwe Keim Jan 04 '11 at 17:05
-
Produce accurate screenshots of differnt websites to the users of the system. – Andreas Jan 04 '11 at 17:25
0
Short answer: no. The ASP.NET runtime won't let you create a Form within its sandbox. Access to the Graphics library is also tied to WinForms, so I doubt that will be much help.
I would take a look at WPF; the XAML markups for layout of controls can be rendered in a forms app or a web browser, allowing you to create a web control that looks like a windows form control.

KeithS
- 70,210
- 21
- 112
- 164
-
I know that I have done this before (just can't find my example program) - I did a webpage that initiated a winform with som graffics in it (directx) and then took a screenshot of that form and showed it to the user via a ashx. – Andreas Jan 14 '11 at 10:38