Cookies Manipulation

Submitted by Karthikeyan on Sun, 19/08/2012 - 18:24

Storing and retrieving data in Cookies..


<%
if request.cookies("numvisits")= "" then
numvisit = 1
response.cookies("numvisits")("num")= 1
response.Cookies("numvisits")("date")= date 
response.Cookies("numvisits")("time")= time
else
response.cookies("numvisits")("num") = request.Cookies("numvisits")("num") + 1
numvisit = request.Cookies("numvisits")("num")
lastdate = request.Cookies("numvisits")("date")
lasttime = request.Cookies("numvisits")("time")
response.Cookies("numvisits")("date")= date 
response.Cookies("numvisits")("time")= time
end if
%>

Cookies Manipulation Cookies Manipulation <% if numvisit = 1 then %> Welcome, You are visiting the web page first time, <% else %> Thanks for visiting the web page again

<%=response.Write(numvisit)%> times u visited this web page
<% end if %> <%if numvisit > 1 then %>
Your last access to this web page was <% = Response.Write(DateDiff("s", lasttime,request.Cookies("numvisits")("time")) ) %> seconds Ago at <%=response.Write(lasttime) %>
on <% =response.Write(lastdate)%>
<% end if %>