How to use HTTP Handler to make a client2client communication? - c#

I'm new to Web programming!
I try to make an app (something like Client to Client communication with C# Handlers and jQuery).
I.E.:
When 1Client make a click on his clientSide(browser), there paints one point, and on the same time the 2Client sees what 1Client did. And, in turn, where 2Client make a click on his browser, there paints one point, and the 1Client also sees what 2Client did.
I could done already the configuration of IIS, I made an simple show Hello World and it run OK.
And, further, what should i done....
Can you advice me, please, with some exemples, or tutorials, how to do this job.
Sorry for my questions which seems to be not studied.

To show a chat like think. The simplest way that I can think.
First you have a table that keep all the chat lines that enters.
Then in a page you have two controls, one text box that users enter text, and one GridView that you show what is on the table.
All of that you place them on an UpdatePanel and you make an internal update to 2 seconds.
So every enter from the users you inserting to the table, and every insert you show to all users.
This is for start.

you can use signalR for this !
It uses a long polling implementation to simulate websockets and it works rather well.
https://github.com/SignalR/SignalR
Quickstart example:
https://github.com/SignalR/SignalR/wiki/QuickStart-Persistent-Connections
A more complex solution would be to use socket io with iisnode/node.js
http://socket.io/
https://github.com/tjanczuk/iisnode/

Related

how to make windows startup project with many methods running at the same time in the background

I have explained my project below and asked some questions with "My Question-" tag.
I have working on a project. At the time of windows logon page if I enter a wrong password my cam should take the picture, If I open regedit my system should take a screen shot and save these images in C:\Windows\system32\new folder (I tried a lot making this work with the help of manifest files but failed everytime) and emails it whenever finds an internet connection
I have a form based app because I didn't find any other way to capture image from webcam directly but taking input from pictureBox1.Image.
My cam, screenshot,email (didn't find a way to autocheck if has internet connection available or not) and 3 events checker for "firewall enable/disable, windows logon failure , regedit event called" are done and they are working good.
What I need to do is to assemble these codes to work as an app and running in the background continuously from the time of windows startup to shutdown
To validate positive events I need to make a desktop based db ("My Question"- still figuring out either to choose sql or localdatabase in c#. Please also tell me a suitable solution.I have to delete all the entries from the db once a day is over). The db would contain the following columns (event id, event name, event timestamp).
I want my app to check if this very event exists in the db then it should ignore the event generated on windows event log else it should make a new row with the db columns and it should do the following actions based on the event like taking webcam pic or screenshot.
"My Question"- I want my app to be live at the time of windows logon page. A lot of programs start later when you are authenticated but I need my program to be live at the time of logon page. Do I have to make 1 or many services? or multi-threaded? because in the typical form based app you can only call one function at a time and wait for it to return something or perform some task/action and then you call the second third whatever.
"My Question"- Do I need to use the backgroundworker in c#
Please help!
You have a lot of things going on here for one question.
You can put all your code in a background service that gets started at boot time. There is a walkthrough here to show you how to do that (along with a million other sites).
Addressing some of the other issues you listed:
Google is your friend...
Webcam - Found a quick reference here and here
File Modification - Another SO thread here
SQL vs. Other Database - Not sure you need anything elaborate here, probably something you can put together pretty quickly. Another SO thread addressing that here
Good Luck!

Online messaging system

I'm building a website at the moment and now i stand in a crossroad to chose which kind of messaging system to choose.
The website is build in asp.net, so using c# and other microsoft technologies i want to build a very simple messaging system between different users.
My question is how to do that, and what is the best way?
One option which i see is to use a database, to store the messages and then let the messaging page, every second refresh and perform code to retrieve the message, altho i tried it and i dont really like, because it isn't the proper way ... letting the page refresh and yeah retrieve the messages it is not very good.
But i dont really know the alternative i tried to search but didnt find any other possible solution only use of database and refreshing of the page.
My question is, what are any other possibilities to implement a very simple messaging system to a website, where for example 2 users can private message each other?
I dont need alot of explanation just some direction where to search ...
Thanks in advance for reading and replying to me, and for admins not to close the thread.
This should get you started.
Simple Chat Application in ASP.NET
Here's another one that looks promising...
LiveChat Starter Kit
Use jQuery and Ajax to get rid of the "refresh" page http://api.jquery.com/category/ajax/.
Regarding if you should use DB or not. Its really up to you, to whatever you are comfortable with. It dosen't sound that you have a lots of requirement.
If I would do it by myself and its a micro project I think I just would store the messages in the HttpContext...

Allowing a WPF browser application to navigate to a separate web page when finished?

I have a WPF browser application that collects user data and adds it to a database to tell them when their software is out of date.
All of that works fine, but the problem is when the application finishes its stuff, I want the web page itself to change (i.e., detect the web app has hit a 'finished' state, then autonagivate to a results page or something).
I can't think of a way to accomplish this, since the web app itself doesn't seem to be able to change the IFRAME it's contained in, much less the page outside of that, or signal to javascript or anything.
Any ideas?
I'd make an variable to keep progress/step of work. And a timer which would check if progress=="done" or sth.
Maybe this is not the best way of solving this but I don't know WPF much and that solution first came to mind

Custom "POST" request to skip website login screen?

There's a certain website I need to access multiple times each day that requires me to enter my login name/password first, every time. To save some time, I copied-and-pasted the HTML source code and pre-populated the text fields with my info, then saved that to my desktop. Now I can just open that doc in my browser and click "submit" without having to type anything.
I'm wondering if I can go a step further. Whatever data is sent when I click "submit" — I'd like to start with that step.
From what I understand, the form info is converted into a POST request and sent to the web server. Is there some way I can concoct that request manually (without using their login screen) and then execute that request each time I need to access the site?
Thanks!
wow, what a safe site! Anyhow yes you could do this lots of ways. Not a good idea to transmit tho locally. Have you ever just tried using one of the form auto forms plugins for FireFox? one button and it will populate your form for you.
https://addons.mozilla.org/en-US/firefox/addon/autofill-forms/
I assume you want to do this in an active browser because you want to be able to interact with the site after logging in, correct?
A really simple way to do this and end up with a workable browser might be to try using WatiN. The library itself is generally used to automated in-browser testing. But at the hear of it, that's kind of what you're doing here. You just want an executable that will open a browser, navigate to a page, populate a form, submit, and present the result.
This isn't so much from the perspective of crafting the POST request manually, but rather just automating the UI interaction.
Ultimately, though, it's going to be a matter of testing it for what your user experience is like. Does it take longer than you want? Does it leave the application running in the background unnecessarily? etc.
Honestly, this might really be overkill. Browsers have form auto-population these days. Maybe a browser plugin to take advantage of that instead? How transparent does it need to be?

reload the sourcecode of a C# app on command

i have a C# application, and id like to be able to make a system, so that within the program, you can display the sourcecode of the application. easy enough so far right?
well, i need them to be able to edit that code, almost like the debug break option... then load the new code and continue without stopping the program. so my problem is, that when this app loads its several thousand lines of code, and it takes a good block of time. after its loaded, it needs to do several hundred operations before allowing user input the first time it loads. also, it has a tcp client in it, and it is very important that it does not get disconnected.
i want people to be able to edit the source, click a button, and wait a few seconds, and have the new code inserted and "rehashed" so to speak, without having to break the overall function of the application.
im looking thorough code examples where possible and an input weather this is possible or not
~ thanks
If you want to allow people to make arbitrary changes to your program, that would be very complex. However, if you want to let them change specific behavior (like rewriting a calculation algorithm) you could have a look at Microsoft.CSharp.CSharpCodeProvide as discussed here.
I don't think you can do that (change a .net app without rebuilding it) but you can have dynamic code loaded and run at any time..
Some people use plugins with Boo, people can change the plugins and these can be loaded at any time by the main app.
But I would suggest you have a look at the Ruby usage inside SilverLight..
This is something completely different, but its something I'm reading on how to start playing with Dynamic code handling: here

Categories

Resources