Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The common Chat room program, that is, the Chat program, does not use the basic structure of the database. So what technology is used? We know that the Session variable in ASP variables is used to record the information of a single user and track user behavior. The Application object acts as a global variable, multiple users on the site can share information on the page.
As you can imagine, in the current chat program, a chat member is a Session variable, and sessions between chat members are shared and displayed as Application variables so that all members can see them.
Next we will use a classic instance program for understanding and analysis.
1. chat. asp
<% If Request. ServerVariables ("Request_Method") = "GET" then %>
<Form method = "post" action = "chat. asp">
<Input type = "text" name = "nick" value = "your nick name"> <p>
<Input type = "submit" value = "come in"> <p>
<Input type = "hidden" name = "log" size = "20" value = "1">
<% Response. End
If Request. Form ("nick") <> "then
Session ("nick") = Request. Form ("nick ")
<Form method = "post" action = "chat. asp" name = form1>
<% = Session ("nick") %> speaker:
<Input type = "text" name = "talk" size = "50"> <br>
<Input type = "submit" value = "submit">
<Input type = "reset" value = "cancel"> </p>
<A href = "chat. asp"> exit </a> <br>
If Request. Form ("log") <> 1 then
If trim (Request. Form ("talk") = "" then
Talk = Session ("nick") & "don't say a word, you just want to give it away"
Talk = trim (Request. Form ("talk "))
Application ("show") = "from" & Request. serverVariables ("remote_addr") & "& Session (" nick ") &" in "& time: "& talk &" <br> "& Application (" show ")
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.