Conditional Refresh

Results 1 to 2 of 2

Thread: Conditional Refresh

  1. #1
    Join Date
    Dec 1969

    Default Conditional Refresh

    I have written a chat app in ASP. In the META tag i refresh the page every 5 seconds. My requirement is such that the chat messages get stored in the DB. What&#039s happening is that, even when no message are posted, the chat page gets refreshed and a DB call takes place which places a severe constraint on my server and also slows down the process. Is there any other way i can accomplish this? ie, refresh the page only when there is a new message?

  2. #2
    Join Date
    Dec 1969

    Default RE: Conditional Refresh

    Sure.<BR><BR>Just put the time of the last-posted message into an application variable (surrounded by Application.Lock and Application.Unlock, of course) and check that against a value you store in a hidden field on the page that submits itself. Only if there *is* a new message do you then go to the DB.<BR><BR>Of course, you could avoid all of this by not using a DB. Just do it with Application variable values. Why do you want to keep the chat in a DB? Just so it will be archived for future posterity?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts