聊天室匿名识别

时间:2012-01-06 09:12:19

标签: jquery asp.net ajax chat

我正在尝试与ASP.NET和ajax / jquery进行随机聊天。当用户进入聊天室时,我需要一种方法来识别用户并给他一个唯一的ID,我将在其中记录他在我的数据库中的单词。我是否需要使用会话,cookie或其他内容?什么是实现随机聊天的最佳方式?

2 个答案:

答案 0 :(得分:4)

<强>会话

- 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

<强>缓存

+ 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

识别用户的绝对最佳方式是数据库(MySQL / Oracle / MSSQL)和cookie的组合。

  • 在cookie中放置一个随机的唯一键字符串,以识别数据库中的输入。
  • 使用数据库中的输入隐藏用户的所有信息。

答案 1 :(得分:1)

我认为你应该使用session_id

相关问题