Advertisement
2_2002-2004 Miscellaneous #128583

Cookie Basics

The first time the users comes to the page, it'll have a text box and a button. Once you type in your nick and hit Set Nick, it'll display Welcome [the nick they entered]. This is just an example on how-to set/read cookies.

AI

Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Código fonte
original-source
' Put this at the top of the page
<%
If (request("REQUEST_METHOD") = "POST") then
Dim Nick
nick = request("Nick")
response.cookies("Nick") = nick
end if
%>
'Put this where you want the Welcome Nick
<% 
if request.cookies("Nick") <> "" then
response.write "Welcome "
response.write request.cookies("Nick")
end if
%>
'Put this where you want the text box to appear
<% 
if request.cookies("Nick") = "" then
response.write "<BR><FORM NAME='message' METHOD='POST' ACTION='THIS_FILES_NAME.asp'><INPUT TYPE='text' NAME='Nick' Size='10' MAXLENGTH='25'>&nbsp;&nbsp;&nbsp;<INPUT TYPE='SUBMIT' VALUE='Set Nick'>"
end if
%>
Comentários originais (3)
Recuperado do Wayback Machine