Can I get away with this or is it just too crude and unpractical ?

Posted by The_AlienCoder on Stack Overflow See other posts from Stack Overflow or by The_AlienCoder
Published on 2010-04-05T08:47:59Z Indexed on 2010/04/05 8:53 UTC
Read the original article Hit count: 187

Filed under:
|

I spent the whole of last night searching for a free AspNet web chat control that I could simply drag into my website. Well the search was in vain as I could not find a control that matched my needs i.e List of users, 1 to 1 chat, Ability to kick out users..

In the end I decided to create my own control from scractch. Although it works well on my machine Im concerned that It maybe a little crude and unpractical on a shared hosting enviroment.

Basically this is what I did :

  1. Created an sql database that stores the chat messages.
  2. Wrote the stored procedures and and included a statement that clears old messages

Then the 'crude' part :

  1. Dragged an update panel and timer control on my page
  2. Dragged a Repeater databound to the chat messages table inside the update panel
  3. Dragged another update panel and inside it put a textbox and a button
  4. Configured the timer control to tick every 5 seconds.

..and then I made it all work like this In the timer tick event I 'refreshed' the messages display by invoking Databind() on my repeater i.e

 protected void Timer1_Tick(object sender, EventArgs e)
    {
       MyRepeater.DataBind();
    }

Then in my send button click event

 protected void btnSend_Click(object sender, EventArgs e)
    {

       MyDataLayer.InsertMessage(Message, Sender, CurrTime);

    } 

Well It works well on my machine and Ive got the other functionalities(users list, kick out user..) to work by simply creating more tables.

But like I said it seems a little crude to me. so I need a proffesional opinion. Should I run with this or try another Approach ?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about chatroom