Reputation: 113
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
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.
Upvotes: 4