Si Young Kim
Si Young Kim

Reputation: 113

chat room anonymous identification

I am trying to make a random chat with ASP.NET and ajax/jquery. When user enters the chat room, I need a way to identify the user and give him a unique id with which I will record his words in my database. Do I need to use session, cookie or something else? What would be the best way to implement the random chat??

Upvotes: 1

Views: 493

Answers (2)

Pierre de LESPINAY
Pierre de LESPINAY

Reputation: 46188

I think you should use a session_id

Upvotes: 1

MicBehrens
MicBehrens

Reputation: 1798

Sessions:

- Will expire if the user are idle for some time in the chat
- Will be terminated when the browser closes, by the server.
+ Cannot be changed by the user

Cookies

+ Will not expire
+ Will not be terminated on browser close, so the system can identify the user to be the same the next time
- Can be changed by the user

The absolute best way to identify the user will be a combination of a database (MySQL / Oracle / MSSQL) and cookies.

  • Put a random unique keystring in the cookie to identify an input in the database.
  • Use the input in the database to withhold all the information on the user.

Upvotes: 4

Related Questions