Monday, December 17, 2007

How to get Cookies value

How to get Cookies value

S T E P - 1

- We can use the Request object to get the value of cookies from the visitor's computer:

<%

Dim strMemID

strMemID = Request.Cookies("Mem")("ID")

If strMemID = "" then

Response.redirect "http://www.websamba.com/cyberprogrammer/login.asp"

End If

%>

S T E P - 2

- We can use For Each ... Loop to ger all values in the Cookies.

<%

For Each Item in Request.Cookies

If Request.Cookies(Item).HasKeys Then 'If this cookies has multiple value

For Each ItemKey in Request.Cookies(Item)

Response.write(Request.Cookies(Item)(ItemKey) & "
")

Next

Else

Response.write(Request.Cookies(Item) & "
")

End If

Next

%>

No comments: