How to use cassia to Create Remote Session and send input? - c#

I know I can use Remote Desktop ActiveX control, but I am trying to implement solution browser based solution just like browserstack.com etc, they have implemented same by using Flash which connects to their server which in turn might be rdp gateway.
I have looked at library Cassia, https://code.google.com/p/cassia/source/browse/trunk/Samples/SessionInfo/Source/SessionInfo/Program.cs, but I am not able to understand how to actually grab the screen and send input after we call WTSStartRemoteControlSession method.
I want to call these methods from an ASP.NET MVC Web Application, which basically stores scripts for automated UI testing. Most of the time, no body will be keeping any UI open, our test server will automatically create RDP session, run everything and then email results.
Only for recording tests, programmers will use Web UI which will communicate with server purely through web sockets and download images of screen. Using ActiveX control is not possible as we use UI Automation to capture text/UI element information etc.

Yeah, Cassia and the WTS API won't help you much here, since they're more for administering servers than interacting with individual sessions.
You could try an HTML5 RDP client like Guacamole. It has a JavaScript client API that allows you to send key and mouse events.

As an alternative, very comparable to Guacamole, you can try Myrtille, also open source and using FreeRDP as rdp client through an HTTP gateway. The main difference is it's done in .NET (C#) and thus is more intended for Windows Servers.

Related

Application send data to web page

I have a web page for data processing. Web page waits for data to process.
And I have a C# application for data. I want to send data to open web page. But I don't want to use socket, Post/Get methods or any web request.
Web page and C# application are client side. They run in same Windows at the same time.
I want to send data to web page from C# app. This operation need to be done with Windows OS or some command line based trigger mechanism.
Web page (Chrome tab or Firefox tab; it doesn't matter) should have tab id the work on. With using this id I may be able to send data to web page from C# app.
But I couldn't really find anything useful.
Is there any way to do this? Is it even possible?
Any advice appreciated.
The way I would approach this is this, assuming you are using either WinForms or WPF:
In your application, embed a web browser:
WPF: https://www.wpf-tutorial.com/misc-controls/the-webbrowser-control/
WinForms: https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/webbrowser-control-windows-forms?view=netframeworkdesktop-4.8
Load the web page in that browser
Establish a two-way communication between your client application and the web page:
https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/implement-two-way-com-between-dhtml-and-client?view=netframeworkdesktop-4.8
If using other technologies let me know and I'll update answer.
One solution is Raw TCP/IP connection on browser but it's not yet fully supported and implemented. If by Web requests you mean online requests then what #DevRacker said is the best I know, too.
However consider TCP/IP, Web sockets and even REST-APIs are frequently used for Inter-Process Communication (IPC) too, when there is no online transmission of data and the data/command is only transmitted over a local machine.
If I were you, I would use Web sockets or maybe a simpler solution such as Socket-IO.

What is the right method for a web chat application in c#

i'm trying to make a chat application using c# that connects to a web server in order to check if there are messages available.
I've tried that by creating HttpWebRequest to check for messages every second, but i notice that it's not good for the server, imagine if there are thousands of users and each user sends an HttpWebRequest every second, that would be heavy.
I heard something about synchronous connection but i think it also sends the same number of HttpWebRequest, (i'm not sure about this part).
So please does any one know the right method for a chat application?
Perhaps SignalR might be useful in your case.
ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.
Actually the most typical tutorial using this technology is web chat.
Use the Remoting.Net
see this :
http://www.codeproject.com/Articles/62813/NET-Remoting-Events-Explained
http://www.codeproject.com/Articles/12586/Remote-Execution-Using-NET-Remoting

How to control application via webservice

I want to control application (in my case it is corelDraw) ,I know I should use it's application object and I do this, but the issue now is I want to do this in webservice,
so as far as I understand if I put this code which control the application in the web-service ,my code will try to control the corel application which is on the server not on the client :(
so any hint/advice how could I do this, and control the application on the client not server ?!!!
As you already noticed web service runs on server and only result is passed to client.
Well you have a few options to control client machine over web service... Here is one of possible scenarios.
1. create web service that will provide commands for client
2. create windows service (client) that will consume your web service commands
3. inside windows service then just execute those commands in appropriate manner
Well I have to say this is not the prefered way I would take to automate corelDraw, but if you insist on using webservice as command provider it will do the job.
You need to ask yourself what is the difference between client and a server. Can a client be a server? Can a server be a client?
You make your client with CorelDraw installed to accept web-service request, i.e. effectively make it a web-service server, and then carry on as normal.
Although I would say web-service is not the best way to control such complex application as CorelDraw. I'd look in some other ways of communication between peers, like lower level network communication that would not have overhead of HTTP.

video calling (center)

We are starting to develop a new application and I'm searching for information/tips/guides on application architecture.
Application should:
read the data from an external (USB) device
send the data to the remote server (through internet)
receive the data from the remote server
perform a video call with to the calling (support) center
receive a video call call from the calling (support) center
support touch screens
In addition: some of the data should also be visible through the web page.
So I was thinking about:
On the server side:
use the database (probably MS SQL)
use ORM (nHibernate) to map the data from the DB to the domain objects
create a layer with business logic in C#
create a web (WCF) services (for client application)
create an asp.net mvc application (for item 7.) to enable data view through the browser
On the client side I would use WPF 4 application which will communicate with external device and the wcf services on the server.
So far so good. Now the problem begins. I have no idea how to create a video call (outgoing or incoming) part of the application.
I believe that there is no problem to communicate with microphone, speaker, camera with WPF/C#. But how to communicate with the call center? What protocol and encoding should be used?
I think that I will need to create some kind of server which will:
have a list of operators in the calling center and track which operator is occupied and which operator is free
have a list of connected end users
receive incoming calls from end users and delegate call to free operator
delegate calls from calling center to the end user
Any info, link, anything on where to start would be much appreciated.
Many thanks!
It sounds like you are in the support business, not in the making of video conferencing software business. Maybe look at licensing 3rd party SDK's to fill in the video conferencing component of the application. It should end up being a lot faster to get your application live than reinventing the wheel. I googled quickly for "Video conferencing SDK". Several popped up immediately. I haven't ever used any so I am not about to start recommending any but I would think that is a good place to start.
I suggest using an existing service (Skype, Google Chat, ...) and control if from your WPF application(s) for the operator and client.
Use a SIP solution with a video codec. Open standard one there are many SIP SDK's out there.

run C# code on client side in a web app

I have code on my server which works very well. It must crawl a few pages on remote sites to work properly. I know some users may want to abuse my site so instead of running the code which uses webclient and HttpRequest i would like it to run on client side so if it is abused the user may have his IP blacklisted instead of my server. How might i run this code client side? I am thinking silverlight may be a solution but i know nothing about it.
Yes, Silverlight is the solution that lets you run a limited subset of .NET code on client's machine. Just google for silverlight limitations to get more information about what's not available.
I don't know what is the scenario you're trying to implement, and whether you need real-time results, but I guess caching the crawl results could be a good idea?
In case you're after web scraping, you should be able to find a couple of JavaScript frameworks that for you.
I think your options here are Silverlight or somesort of desktop app
Unless maybe there is a jquery library or other client scripting language that can do same things
That's an interesting request (no pun). If you do use Silverlight then maybe instead of porting your logic to it, create a simple Proxy class in it that receives Requests from your server app and shuttles it forward for the dirty work. Same with the incoming Responses: have your Silverlight proxy send it back to the server app.
This way you have the option of running your server app through the Silverlight proxy in some instances, and on its own (with no proxy) in other scenarios. The silverlight plugin should provide a consistent API to program against no matter which browser it's running in.
If using a proxy solution in the web browser, you might even be able to skip Silverlight altogether and use JavaScript/AJAX calls. Of course this kind of thing is usually fraught with browser compatibility issues and it would be an obscure push/pull implementation for sure, but I think JavaScript can access domains and URLs and (in some cases of usage) not be restricted to the one it originated from.
If Silverlight security stands in the way you might look into other kinds of programmable (turing complete) browser plugins like Java, Flash, etc. If memory serves correct, for the Java plugin, it can only communicate over the network with the domain it originated from. This kind of security is too restrictive for your crawling needs.

Categories