Wednesday, June 24, 2009

Build a Web Chat Application using ASP.Net 3.5, LINQ and AJAX (in C# 3.5 or VB 9.0)

Technologies Used

ASP.Net 3.5, AJAX, JavaScript, C# 3.5 or Visual Basic (VB) 9.0, LINQ-to-SQL, MS SQL Server 2000/2005

You will also find the VB 9.0 article here.

Introduction

A Java Programmer friend of mine once asked me if I have ever built a web chat application. I said "No". He then asked me if I were to build a really simple, monitored, bare minimum, working web chat application, how long do I think will it take (something to that effect). I said, "I don't know". A few days had passed, one lazy evening, I was surfing the web looking for ASP.Net web chat applications. It seems that I can't find one that is simple enough to implement. So I decided to just build something simple from scratch. When I say simple, that just means that: I'm am going to try to build this web chat as fast as possible, with very minimal planning or architecturing. So what you will read below are my notes after I got done building the web chat application. Here's an example of how the chatroom page looks like:


Background

We will create a very simple web chat application using the latest ASP.Net 3.5 technologies from scratch just for fun. This chat application will contain 2 web pages, the login page and the chatroom page. Most of the tutorial will be focused on the chatroom page. Some of the things that I want to accomplish are as follows:

  • Must be accessible anywhere, and no need to download and install any components. This is why we're going to create a web chat.
  • Web chat must be "flicker-free". This is where AJAX will be very handy.
  • We want to be able to monitor chat conversations using a database. We will use MS SQL Server to store conversations and user information.
  • No use of frames. I read somewhere that frames are evil, and I kind of agree with that.
  • Use of dynamic SQL using LINQ-to-SQL instead of stored procedures for a super fast coding. Remember that we're doing this for fun.
  • No use of Application Variables. I've seen some examples on the web that uses application variables and I just don't like this idea.
See detail: http://www.codeproject.com/KB/aspnet/WebChatAsp35LinqAjax.aspx

No comments: