A set of technologies in .NET for building web applications and web services. Miscellaneous topics that do not fit into specific categories.
Hello @Vereato and thank you for reaching out.
If I understand correctly, you want your Windows Forms client to connect to each chat room (chat1.aspx, chat2.aspx, chat3.aspx) the same way, loading that room's messages and users from the server.
For example:
- On the server, have each room's page (or a generic handler
.ashx) query MySQL for that room's messages and users, and return them as JSON or plain text instead of rendering HTML. - In the Windows Forms app, store the URL for each room, for example http://chat.room1:6060/chat1.aspx, http://chat.room1:6060/chat2.aspx, and so on. If you use an
.ashxhandler, use its URL instead. - When the user selects a room, send a request to that room's URL using
HttpClient. - Parse the response, then put the messages in the
RichTextBoxand the users in theListView.
To keep the chat updated, repeat the request at an interval, for example with a Timer.
If you plan to add more rooms later, you can also use a single endpoint that takes the room as a parameter (for example, chat.ashx?room=1), so you don't need to create a new page for each room.
You can find examples of sending requests and reading responses in the Make HTTP requests with the HttpClient guide.
If this isn't what you're trying to do, please clarify what you'd like the client to do when it connects to a chat room.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation. Thank you.