ServersBuilding a simple chatroom

Building a simple chatroom

ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Paul Smullen

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

The chat room in this example uses a frameset with four frames;

  • An advertisement frame
  • Messages/Chat frame
  • Login/post message frame
  • Application Status frame

    Advertisement Frame

    A place to put an advertisement banner or a link back to your main site.

    Messages/Chat Frame

    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.

    Coding Outline…
    Two Application arrays exists

  • Users – holds the names of all users logged on.
  • Messages – holds the latest n messages.

    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.

  • Get the Free Newsletter!

    Subscribe to Daily Tech Insider for top news, trends & analysis

    Latest Posts

    Related Stories