Print Screen of Current Webpage Screen using wcf( not using url ) - c#

I want to take a screen shot of current screen(print screen of current screen as an image) using WCF service.
I have googled code and I found some code (like memoryGraphics.CopyFromScreen ) and that is fine working in my local machine. but when I hosted on IIS server then it gives me an error that there is no screen on the server .
so is there any way to get a screenshot of a current web page as an image
Note:
I can not use http://html2canvas.hertzen.com/ or any other tool which accept URL because my web page URL is same ...data is a render from jQuery.
So without passing URL I want a screen shot of current web page.

In order to take a screenshot of a desktop, the executable taking this screenshot must be running on the target device.
In your tests the executable (WCF service) is running on the webserver and will attempt to take a screenshot of the webserver when you execute it, not the client performing the WCF request.
You are left with a few options (that I can think of at the moment):
1) Use an application that can be installed on the client to perform the screenshot, and send the screenshot data to the WCF service. This can be either a straight forward EXE with installer. To make the user experience easy for the user it could be a ClickOnce deployment (http://www.codeproject.com/Articles/17003/ClickOnce-Quick-steps-to-Deploy-Install-and-Update)
2) Use some sort of plugin designed for the target browser. Same rules apply, it runs on the client, takes the screenshot and sends the screenshot to the WCF service. Probably a lot of work here to work with many browsers.
3) If you only want to take a screenshot of a web page from an application you own and modify the source of then you could write some javascript that essentially sends the current state of the DOM of the document to a WCF service and the service could then render the DOM on a kind of virtual browser. E.g PhantomJS (http://phantomjs.org/), or Awesomium (http://www.awesomium.com/). Then save the rendered output.

Related

Hosting Webpage over Local Area Network in C#?

I have a C# form application that has different functionality. Additionally I want to add another service to the existing project which is hosting the webpage "CameraCapture.html" page over Local Area Network as a web service in order to be viewed from another client on the Network.
For this purpose I have added one form "frm_cameraServer_monotor" and two Buttons in this form, btn_StartServer and btn_StopServer, which to start serving "CameraCapture.html" and to stop serving it. My IP Address on LAN is: 10.140.191.200 (static).
I don't want to use any web server like Apache and ISS to be installed and configured. Just I want a server service to existing project.
Any one can understand and help me in this topic, really very appreciated Thanks.
I want to start web-service but without web-server
If it is just a plain HTML without back-end but not a web-service, then you can create a shared folder and open it as a file from your network. HTML and front-end JS scripts will work well. However, the link will be like:
file:\\COMPUTER-001\Camera\CameraCapture.html
If it is ok for you, then you can easily do this without web-server.
You surely cannot make it work this way without any HTTP-server:
http://COMPUTER-001/CameraCapture.html
Is it worth it?
Install a simple web-server, you even won't need to configure it if a single HTML file is everything you need.
If you want to host an asp.net site on your application (winforms/service/wpf/whatever) you can use CassiniDev
Then simply publish your web project to your filesystem and use:
CassiniDev.Server server = new CassiniDev.Server({port number}, {publishedSitePath});
server.Start();

Launch IE from metro app and send post data to the website

I want to launch a website in IE from my metro app. While launching the website post data also need to be send.
I tried using Windows.System.Launcher.LaunchUriAsync(uri);
I am facing two issues here.
one, i am not able to send post data to the website. Second, the IE is taking only 50% of the screen. I want it to consume the entire screen.
How can i possibly do that?

view the GUI of a .net application on remote pc (no remote desktop or vnc etc.)

I read several articles but didn't get an understanding regarding WCF (or remoting or ...).
I have written a .NET 4.0 WinForms application running on one PC where a user is making inputs.
I would like to display the GUI of the application on a second PC.
No inputs on the second PC, just viewing the application.
How might this be possible? (WCF or no WCF?)
(controlling the whole PC with remote desktop or vnc is no option)
Thanks a lot for any suggestions,
Ralf
You could make the main application expose a WCF service and have a second view application consume the service to view the data.
If viewing the area of the screen the application resides in is an option, my library RemoteViewing may be sufficient for you.
The included example server (it includes both client and server VNC) is read-only.
In the example server, instead of passing a Screen as a second argument to VncScreenFramebufferSource's constructor (that will capture the entire screen), provide a callback to the screen rectangle containing the application. That should be all you need.

Windows Form application run on Windows hosting service

I've created a Windows Forms application that basically contains an HttpListener which launch a Form for each request. I have to show forms server side because I have to take a snapshot of what it's shown on the screen to send it to the client.
I've also made a asp.net web application in which I show those images sent from the HttpListener who act as a server.
Everything works fine on my machine but now that I must deploy it on my company's website I dont know how to do it, anyone has a solution? I haven't remote control on server, I can just upload files inside using FTP.
What if I create a page inside my web application to launch the exe file? Any suggestion is really welcome!
I'm definitely no OpenGL expert but I believe that its possible to use OpenGL to render a scene without displaying it to a screen. Some preliminary research indicates that "pbuffers" allow you to render an image to a texture (which would presumably then allow for programatic access).
Can i save an OpenGL scene as an image without showing it?
Note that using OpenGL probably depends on the server machine having a suitable graphics card. As most servers don't come with very capable graphics card (some servers don't come with any graphics card) this is definitely something that you should check beforehand.

Local Testing and Debugging Facebook iframe app (Windows Azure)

I wonder what the best way to test and debug facebook iframe applications locally (using the facebook c# toolkit and the azure toolkit)?
When i try to debug it's always starting the Compute Emulator on a different port.
Basically i want to have a special facebook iframe app pointing to a specific port on localhost (e.g. http://localhost:81) and after pushing the debug button that my app url (e.g. http://apps.facebook.com/myspecificappdev) is being started in my browser (with debug functionality).
I found this thread but unfortunatly this didn't help me a lot: http://azuretoolkit.codeplex.com/discussions/207487
What's the best way to debug such applications? Is their maybe a sample project which already has that part set up correctly?
Ok, here is what we do (at Thuzi). We set up an dedicated IIS web site for our code. We create a bogus domain like fbapp.mycompanysdomain.com and then we edit your machine's (or other machine's) Hosts file to point to the proper IP address. When we set up the site in IIS we use a host header which means that we don't need to worry about port numbers. When we debug we simply attach to the process.
So you point your web browser to the FB URL and it should always land on your web server (whether you are debugging locally or not). I know this sounds like a little more work, but it ends up being so much easier in the long run and better reflects what will ultimately happen. I realize if you are using any kind of storage then you will need to start that up, but it's still a lot easier this way..
If your app is simply a website, then you don't need to run the compute emulator to run it. I would setup the site so that it runs on IIS on a specific port, then debug the website project, not the cloud project.
There is a bit more to it than just that however. If you're using development storage then you'll need to start that yourself as it won't automatically be started when you debug the website. If you have a RoleEntryPoint class then you need to be aware that none of that code will be called. Also if you make use of anything in RoleEnvironment (like settings) you'll need to put a wrapper around those items so that they'll still work when not running under the emulation environment (RoleEnvironment.IsAvailable is very useful for detecting this). A setup like this is very useful during development because when you make small changes to CSS of JavaScript you don't need to restart the compute emulator to see your changes.
You're on the right track. You need to create a new facebook app and point the iframe / canvas / tab url to localhost with the specific port cassini chose for the project.
What I did to ensure the the windows azure app stays on the same port:
I placed this as a pre-build event:
"C:\Program Files\Windows Azure SDK\v1.4\bin\csrun.exe" /devfabric:shutdown
This makes it better but it's still switching port sometimes

Categories

Resources