Online messaging system - c#

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...

Related

Looking to trigger part of a C# script by external event

ill try to keep my question short, littlebit of context:
I'm not a programmer, I work as engineer making configurators. I made a C# (.NET) .exe that uses another program's API to preform actions, right now it does so by me clicking a button on a windows forms application. This is already great, but i'm looking to automate further.
What is my goal? instead of me triggering a part of my script by clicking, i need it to trigger automatically.
Under What condition do i need to trigger? Right now i use Power Automate (previously know as Microsoft flow) to write data to Excel file, when it is finished writing data there, the script is allowed to trigger once.
What ways of achieving this do i see?
I could possibly use Excel API to detect a change of values inside my Excel document and trigger the script that way
I see i can create a Webhook in Power Automate and send a HTTP push
Again, i am not a programmer so i don't have to knowledge to make a good descision here. Maybe there is other ways to accomplish my goal aswell. I need a bit of direction and reference so i find the right solution and implement it.
Thank you all, if something is unclear or more information is needed, let me know!

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?

How to make message notification like Stackoverflow?

Our team want to add the notification function on our website. Now, it's the design stage. Could someone point me in the right direction?
Open up your web browser and go into firebug/chrome inspector/developer tools. Visit the stack overflow site. Look on the console at the global variable 'StackExchange'. It has everything you need for notifications, how votes are added, comments, etc... It is very well designed and very thought out. I use it as inspiration constantly.
It's a pretty straightforward task, but if you want to simplify the process, there is a jQuery plugin that does it here. There's also a more popup-style plugin called JNotifyOSD.
The jnotify plugin will give you what you need to make this happen on the client side. Once you have a mechanism for making your notifications available to the browser, you can just call jnotify to display the notification.

ASP.NET C# Sending Information Back to Client While Processing Web Page

Not sure if I'll explain this properly but here goes. I having written an asp.net app using C# for the code behind. After the user makes some selection and hits the "run" button I pass off the processing to a dll written in C# but what I want is a way to periodically send information back to the client so they can see what's going on like how many records have been processed and things like that. How can I accomplish this?
thanks
Have a look at Provide feedback to the user on Long Running Tasks – using loader image - MS AJAX and JQuery
Also: How Do I: Use the ASP.NET AJAX UpdateProgress Control?
There are many ways of accomplishing this kind of task. I am presenting a few ideas
Solution 1:
You can use Ajax Timer Control.
Solution 2:
Make a Windows Service that will read the information and will interact with the asp.net application to notify about the requested information. It will act as a background worker.
Hope this helps
This may have been my wording of the question but I found what I was looking for. You can use the HttpResponse.Flush method to achieve what I was trying to do.
This is often called HTTP Server Push or HTTP Streaming or Long Polling. Depending on how it's done.
You can also check out this SO question on HTTP Streaming...
Cross-browser implementation of "HTTP Streaming" (push) AJAX pattern
Or this one with an example of Long Polling
How do I implement basic "Long Polling"?
https://stackoverflow.com/questions/tagged/long-polling

Visual feedback from C# service

Is it true that a service written in C# is unable to give visual feedback to the desktop?
I understand that services start up before user logon and at that point ther is no desktop available. My question then, apart from logging events in the system event log which is not a very efficient way of communicating to the user, what are my alternatives for showing a message box from a service?
Only two options come to mind:
MessageBox.Show - Looking around it seems this is not going to be an option.
Show a custom form
I've not given the reasons for why this messagebox needs to be shown.
Please assume that it needs to be shown as I don't want responses on "good practice". Not at this point at least.
A windows service should not perform interactions with a user. Instead you should create a seperate control or configuration application - often put into the system tray - that communicates with the service an can present information to the user or gather inputs.
See this Knowledge Base article and this MSDN article if you really want to do this. They contain some hints how to achiev this an you will probably need to use P/Invoke from C#.
Here are some ways that you can make interactive services. But, those have gone away with Vista.
One way you can have a user get information from a service is to build a separate UI for the purpose. The service could have a WCF endpoint for example and push messages out that the GUI would show. That way, you only show a message when there is a user logged in and it's not a security risk by popping up a window from the LocalSystem account. You could easily make this GUI run from the tray and pop-up toast so it is non-intrusive and begins when the user logs in. Much much better than trying to interact directly with the desktop.
I've never used it, and I include all of the disclaimers about not doing this.
However, you may want to check out the MessageBoxOptions.ServiceNotification enum.
Here's a good blog post detailing its use.

Categories

Resources