hmmm,
typing the title made me feel like i am a hacker asking for some illegal stuf....
but the truth is different i think. My client wants to control 3 webapplications at different computers at the same time.
I can't say exactly what the porpose of this is, but he wants, when he clicks on computer A at button 1 in the browser, that on computer B in the browser also is clicked on button 1, and also on computer C.
When i devided this process in 3 steps, i realized that none of them are things i've done before:
first thing is to get the click event out of the browser
second is to inform computer number B and C of the click event
third is to click a button in the browser of computer B and C
Three things i don't know how to accomplish (i have done some remoting in the past, maybe that can work for the communication between the three computers, but all i remember is that remoting did NOT become my friend)
So if you can give me any clue on how to catch browser events outside the browser, talk between two pc's and raise events in the browser from outside the browser, your help would be greatly appreciated.
EDIT:
i don't control the application. My client will use it to send multiple stock orders. so i think you can compare it with up-vote on a voting website
I know this is not an answer directly to your question, but it is a valid answer from a business and developer standpoint.
Unless your client is willing to pay through the nose for development time, it would be better to find out WHY the client wants this and offer possible alternatives. What they're asking can't be done without a LOT of work. I'm not sure where I'd even start - probably writing my own browser using the BrowserControl in a WinForms app, and using Remoting to control the WinForms app.
Really, you're better off researching the requirement better and proposing an alternative that is doable. Part of being a good devloper/analyst/project manager, etc is to be able to correctly divine what the customer actually needs from what the customer SAYS they want.
It could be that they just need you to track the status of something and your separate browsers need to auto-refresh. Or it could be that WinForms is not the right tool for the job. Or it could be something completely different. Heck, it could be as simple as only having one browser, and people can "watch" that browser from another PC using VNC or a similar tool.
There are usually multiple ways to meet a business need without focusing on difficult technical requirements. It's the business need that matters. and if you can find another way to meet it, you won't need to spin your wheels on this type of question.
As an added note, it makes me cringe to hear that you're even looking for "how to do this" without understanding why. Getting the requirements right is SO important in development. Most projects fail because the communication of requirements was not adequate.
What you want to do looks like 'shared browsing' or 'follow-me browsing'.
There are some questions that need to be asked :
do you want to do this with or without installing some sort of browser plugin or application ?
is the 'shared browsing' done only on a web application that you develop or do you need to browse to remote websites where you cannot add code.
If the web application can be modified, you could have all clients:
Send all actions they do a server ( #id1, click )
Poll the server for a list of actions that need to be triggered ( jQuery('#id1').click() )
If only one of the client is "master" and all the others are slave, it should be easy enough to synchronise everyone.
In a multi-master setup, synchronisation will be a little more complicated, and then maybe you will be re-developing Google Wave ;-)
Now if you need to be able to do shared browing over any website, thats a lot more complicated. Even more complicated if your solution needs to work cross-browser. You will need to develop extensions for each supported browser or native applications for all supported OSes. I advise you to look for existing solutions that already do have the shared browsing feature. You can also take a look at the VNC family of solutions (full desktop control).
I hope this will help you,
Jerome Wagner
Related
I have a web-based picking/packing solution for delivering orders (asp.net/c#). Orders are marked as packed in the browser and then immediately the label information is added to our database, ready for the next part...
The label printing is done via a Windows application (written in C#) and was done this way because I couldn't find a way of getting the browser to print the label automatically (i.e. without the user having to click Print/OK, etc.)
The problem:
The Windows application polls every 10 seconds (subject to change) to see if there are any new labels for that picker/packer. Now, if I could get the browser to communicate with the label application then the polling would be unnecessary, since the picker/packer would have just clicked "Ready to Ship" and the label data would be created.
The data that is pulled down by the polling process isn't vast, but I'm concerned that as we add more picker/packer stations the polling process could have a knock on effect to the web server/database (since all stations would be polling). Also, pickers/packers don't want to wait around waiting for labels, so extending the polling time isn't possible (if anything I'd like it as quick as possible)
Solutions?
So, ideally, I'd like a way of communicating between the browser and the application (if possible). Or any method that removes the need for polling. Perhaps something akin to Comet, that allows the server to send a message to the application when a new label is added.
Ideally, a solution that wouldn't require a specific browser. But this may be asking too much.
A long-term solution would be to move the web-based picking-packing solution into the label application, but that would be a lot of work!
I hope that's clear and not too wordy. Let me know if I can add any other details in here. Thanks in advance.
Edit
Am looking into websockets as an idea. Any advice will be more than welcome!
Update
Thanks for all comments. I've now got a few ideas on how to solve the problem:
Websockets. May be problematic with firewall issues since I don't have easy access to the system (geographical distance)
Read browser cookies from the application. Possible solution http://www.codeproject.com/Articles/330142/Cookie-Quest-A-Quest-to-Read-Cookies-from-Four-Pop. This covers all the browsers that are in use in the warehouse. I can poll the local cookie values and see if any new labels have been created, then download them. Therefore no polling on the database server.
ActiveX control. Limited to IE and perhaps there'd be some security/setup issues with installing this on each PC.
Leave the code as is. Gauge whether the load on the database server is too much or ok.
You could create a local WebSocket server in your C# application and then make the browser connect to it and send the data you need to print.
I'm not sure, though, that this is what you need. As I see it you need to pass graphical data to your application, which could be really tricky to do using only javascript.
The appropriate way to achieve the communication between a web application and a desktop application would be to go through a server both apps talk to.
You can get any web-server (e.g. node.js nodejs.org that will let you use the same javascript you use for the web-app on the server) and interact with it. How you talk with the server from the desktop app depends on its technology. However all languages have some way to do http communications like SOAP.
Or you can try to make:
Both apps talk to the server using socket.io. You can borrow code from the following project.
Create an MSMQ (or a queue implementation of your choice) and host a WCF service in your windows application that polls the MSMQ.
Have your ASP.NET application write any relevant information to this queue so that the WCF service in the windows app that pulls this information will know what to make of it and print your labels.
The reason I mention a queue is for reliability, if your windows app goes down for any reason, the queue will at least be preserved and waiting for you to bring the windows application back up.
Although there is a bit of polling involved, it is very quick and almost neglibible. Implementing it is automatic with NetMsmqBinding, it's all taken care of. All you need to do is configure it.
If you go for a non-MSMQ queue, then I don't know whether you can still use NetMsmqBinding, you may have to create your own.
I'm not sure, but it seems like your application is polling a filesystem for these new labels to print? Have you considered using a FileSystemWatcher in your application? You can set that to watch a directory and be notified of anything new.
Background:
I am creating a Windows Form App that automates order entry on a intranet Web Application. We have a large amount of order entry that needs to be done that will cost us a lot of money so I volenteered to automate the task.
Problem:
I am using the webbrowser class to navigate the web app. I have gotten very far but reached a road block. There is a part in the app that opens a web dialog page. How do I interact with the web dialog. My instance of the webbrowser class is still with the parent page. I am hoping someone can point me in the right direction.
You've got a number of options. To expand on the answers from others and add a new idea...
Do it using the webbrowser control: This is technically possible by either injecting javascript into the target page as demonstrated here or creating a JavaScript object and using it as a bridge via the webbrowser.objectforscripting property. This is very fragile - something as simple as the website changing an element's Id could break it. You also need to make sure your code doesn't interfere with the functioning of the form (clashing function names, etc...)
Do it using a postback: Monitor the communications between the web browser and the server (I personally prefer Firfox/Firebug but ie/Fiddler or Chrome/F12 are both good too). As long as you can replicate the actions of the browser exactly, the server can't know the difference. The problem here is that browsers are complex and the more secure a form is, the more demanding servers are. This means you may have to fake a login, get cookies, send them back on subsequnt requests, Handle Viewstate data and xss prevention variables. It's possible and it's far more robust than the first option but can be a pain to get working. If it's not a highly secure form,, this is your best bet. More information here
Do it by browser automation: Selenium is probably the best option here (as mentioned by others) but suffers from a similar flaw to the webbrowser control in that it's sensitive to changes on the form itself (But not as mcuh so as the webbrowser control).
Incidentally, if you have Visual Studio Ultimate/Test edition (and some others, not sure which), it includes a suite of testing tools including an excellent engine to automate load testing a website. This is also superb for tracking down what exactly a form does as you can see every step of the emulation.
Hope this helps
You have two choices depending of the level of complexity you need:
Use a HTTP Debugger like Fiddler to find out the POST data you
need to send to each page and mimic it via a HttpWebRequest.
Use a Browser Automation Tool like Selenium and do the job.
NOTE: Your action may be considered as spamming by the website so be ready for IP blocking, CAPTCHA...
You could give Selenium a go: http://seleniumhq.org/
UI automation is a far more intuitive approach to these types of tasks.
We are looking into the possibility of allowing users to opt into a program where they report what button clicks etc. they do, and I was wondering if anyone can suggest a good library which already does this. Based on the way the app is implemented, we have access to the base "Button" class and can add code on the click which records the fact that the button was clicked.
What we're looking for is a library which can record all these clicks, store them locally, and then send them to us at some point in the future when the user has internet access.
Does something like this exist in an open or closed form?
Thanks,
Liron
Our app can run code in either c# or javascript, since it runs in Unity3d, but we have other desktop apps which are pure c# and would prefer a library we can run across all our applications.
We ended up going with DeskMetrics, which seemed like a good fit for our needs. We also looked at TrackerBird which has some nice features which weren't necessary for our particular requirement and wasn't working within the limited requirements of Unity3d.
My user go to my company's website and logs in to view information. I want my users not being able to login unless they have a particular antivirus installed.
So, If they have (for example) trend micro installed they should be able to login and if not they should not be able to.
Help is highly appreciated.
A.D
If that is for corporate / domain use, then group-policy might be a better option.
Trying to do this in a browser is going to be tricky; since it is IE you could perhaps do something awful with an activex control, but that is opening one security hole to check that a different security hole is closed. And the activex one is (IMO) of more immediate concern! Also consider that by default, or by choice, most options will be locked down.
And even if you get it working for IE; for virtually any other browser you don't have such options - and designing just for IE is... (chooses words carefully) against best practice.
But also; for a web-site, how is it necessary to know this? Especially if it is your web-site: simply, don't put malware on there, and don't leave XSS holes. My bank doesn't demand any specific anti-virus, after all.
Boring background:
I have been working with UltraVNC to control some PC's at work and it does the job great but in order to simplify things I created a program that interfaces with it in C#. Basically I take advantage of the commands the viewer offers to connect, control, watch or transmit to each PC.
Problem is anyone can access the PC's since it has one main account (no domain controller). I need everyone to sign for the PC before they can use it, so to make my job easier I open each PC and block the inputs + blank the screen that way there obligated to sign before use.
Opening each pc and press the block button can be hassle especial when you’re helping someone and a user leaves, others come (btw I work at an electronic library). UltraVNC doesn’t have a command for this; it’s been requested but I don’t think it’s much of a priority for them and the code seems very intimidating for a novice like me so I thought I could try a hack to get what I want.
Problem: I want to “click” a button in a program I use, from an application that I am building in c#. I can currently use the process class to get the handle and identify the specific window I want to use but I have no way to find the button handle which I read is what I need. I found stuff about using findwindow and sendkeys for this but I don’t see how that’ll work unless the button had a keystroke assigned to it which it doesn’t.
So can anyone point me in the right direction?
Why not use something like Eficium Cybercafe SurfShop to achieve what you want? After teh user finished you log the session out, and before someone can log in, they have to sign in.