Building a simple chatroom
Building a simple chat room using ASP is just that - Simple.
Chat rooms make a good example of when to use local, Session and Application level variables.
The chat room in this example uses a frameset with four frames;
A place to put an advertisement banner or a link back to your main site.
This frame shows all messages posted and who posted them.
Login/post message Frame
Before you can post a message you must sign on or log in. This is just an alias that you can be identified as by other users. There is no tracking of user's details carried out.
Application Status Frame
This shows the date and time of the last message posted and a list of people who are currently signed on.
Two Application arrays exists
When a user signs on, they are added to the Users array. The contents of this array are displayed in the Status frame which is refreshed at a set interval.
When the user logs off they are removed from the array.
When the user posts a message it is added to the message array and displayed in the Message frame. Building a simple chat room using ASP is just that - Simple.
See it in action...
This is running here if you want to see how it works.
Download sample code...
Download a ZIP file containing the ASP pages for this applications.
Feel free to contact me by e-mail if you have any queries.